.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

insert checkbox values for the same id

Posted By: kokulakrishnan     Posted Date: January 21, 2011    Points:2   Category :ASP.Net
actualy im studying asp.net + c# (self study). I got a concept to implement.If i have Approximately 50 check boxes, how to insert those checkbox values to 1 column.

Eg:-
if a bus has 50 seats ,assume that the seats are denoted by check boxes,and the passenger must thick the suitable check box to book that particular seat.the table "Bus" has column like bus_number,seat_numbet,status. the bus_number column is duplicate one, because all the seats placed in one bus.one passenger can book more than 1 seats. bus number displayed on a lable, all 50 check boxes named 1-50.

i need to no how to use parameters,if 1 passenger select seats and press button the lable value is inserted into bus_number , check box value inserted into seat_number and the checked status is inserted into status as true or false.

how can i give all the check boxes' parameter in one query..
can display 50 checkboxes without drag and drop 50 times???

can any one help me..
advance thanx




Responses
Author: SureshM             
Posted Date: January 21, 2011     Points: 5   

Hi,

If u configure the total no. of seats in table, u can create 'N' no. of check boxes dynamically..

I need some clarification in ur requirement.

If one passenger selects more than one check boxes, how do u need to store the seat nos in table?
All the seat nos are stored in single column and one row for the passenger .

bus_no passengername Seatnos
12 suresh 12,13,14

OR
U need to store the seat nos as each record for each selected check boxes?
bus no passengername Seatnos
12 suresh 12
12 suresh 13
12 suresh 14




Author: Syed Shakeer Hussain             
Posted Date: January 21, 2011     Points: 5   

Hi,
You can show 50 seats data by using single CheckBoxList.

Adding data to CheckBoxList:

for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
CheckBoxList1.Items.Add(ds.Tables[0].Rows[i]["ColumnName"].ToString());
}


(Or)
Add items to CheckBoxList programmatically and databind()


ds1.Tables[0].TableName="mov";
CheckBoxList1.DataSource=ds1;
CheckBoxList1.DataMember="mov";
CheckBoxList1.DataTextField="des";
CheckBoxList1.DataValueField="idmov";
CheckBoxList1.DataBind();



Author: kokulakrishnan             
Posted Date: January 21, 2011     Points: 5   

thanks

i need to store the seat nos as each record for each selected check boxes?
bus no passengername Seatnos
12 suresh 12
12 suresh 13
12 suresh 14



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend