I working in asp.net with C#..designing in asp.net and code in C#...sql server 2008,I need to load the checkbox list from database n is : Add,Edit,View,Viewall (each are seperate row with different Rightid) in the checkbox list..if the User select the Add,View,edit,viewall
its Ids(four diff) must be add to the database in Rights table..Can u please help me how to do.if use choose only Add,Edit,that id must be add to the database in rights table.
I working in asp.net with C#..designing in asp.net and code in C#...sql server 2008,I need to load the checkbox list from database n is : Add,Edit,View,Viewall (each are seperate row with different Rightid) in the checkbox list..if the User select the Add,View,edit,viewall
its Ids(four diff) must be add to the database in Rights table..Can u please help me how to do.if use choose only Add,Edit,that id must be add to the database in rights table.
Thanks,
Nirmala
</div>
Hi Nirmala
Please try to refer to the following code:
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckBoxList1.SelectedValue == "Add")
{
//do the query
}
if (CheckBoxList1.SelectedValue == "Edit")
{
//do the query
}
if (CheckBoxList1.SelectedValue == "View")
{
//do the query
if (CheckBoxList1.SelectedValue == "Viewall")
{
//do the query
}
}
}
Because you do not tell details about what the code to do, so I just wirte down the code above, if you have any doubt about the code, please tell me.
Thanks,
Amy Peng
Please mark the replies as answers if they help or unmark if not.
Feedback to us
Nirmala82
0 Points
8 Posts
checkbox list with sql server
Nov 09, 2012 02:40 AM|LINK
Hi,
I working in asp.net with C#..designing in asp.net and code in C#...sql server 2008,I need to load the checkbox list from database n is : Add,Edit,View,Viewall (each are seperate row with different Rightid) in the checkbox list..if the User select the Add,View,edit,viewall its Ids(four diff) must be add to the database in Rights table..Can u please help me how to do.if use choose only Add,Edit,that id must be add to the database in rights table.
Thanks,
Nirmala
</div>Shailendra S...
Member
551 Points
145 Posts
Re: checkbox list with sql server
Nov 09, 2012 03:01 AM|LINK
You have to have the sp parameters as
@mode
@tableNAme
In you sp you need to check the @mode
IF @mode='A' 'Means Add Mode
Write insert query
If @mode='E' means edit
Write update query
www.techaray.com
Amy Peng - M...
Star
11739 Points
1097 Posts
Microsoft
Re: checkbox list with sql server
Nov 12, 2012 04:48 AM|LINK
Hi Nirmala
Please try to refer to the following code:
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { if (CheckBoxList1.SelectedValue == "Add") { //do the query } if (CheckBoxList1.SelectedValue == "Edit") { //do the query } if (CheckBoxList1.SelectedValue == "View") { //do the query if (CheckBoxList1.SelectedValue == "Viewall") { //do the query } } }Because you do not tell details about what the code to do, so I just wirte down the code above, if you have any doubt about the code, please tell me.
Thanks,
Amy Peng
Feedback to us
Develop and promote your apps in Windows Store
ramiramilu
All-Star
97923 Points
14516 Posts
Re: checkbox list with sql server
Nov 12, 2012 10:37 AM|LINK
simple way to store checkboxlist data into database - http://guidecoders.blogspot.in/2012/01/how-to-checkboxlist-values-saved-in.html
thanks,
JumpStart