Handling checkboxes in datagrid view

Posted by Toashish80 under C# on 2/24/2011 | Points: 10 | Views : 3926 | Status : [Member] | Replies : 7
I have a data grid view containing 3 columns with first column as checkbox. I am trying to get the selected rows and then insert the data in the database.When I am executing and clicking on the checkbox nothing is happening.




Responses

Posted by: Prabhakar on: 2/24/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Toashish80,

i think you use check ur checkbox in for lop . if it is click so that row are insert in ur database. then then they go to next row . for check checkbox are checked or not. .

Best Regard's
Prabhakar

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: SheoNarayan on: 2/24/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Hi Toashish80,

You can read http://www.dotnetfunda.com/articles/article408-how-to-get-a-multiple-selected-values-from-a-gridview-using-aspnet-.aspx article on this website that has explained this in details.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Toashish80 on: 2/24/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks Sheo for the info but in my case its a windows based application and not a web based.



Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 2/24/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
On submit you can loop thru the data grid rows and fetch the column where you have the check box, check if that is checked capture the id into a string and then using the dataview filter the dataview and u will have the selected rows in a datatable to save into DB.


Thanks and Regards
Madhu

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 2/24/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Check this link

http://www.codeproject.com/KB/miscctrl/GridViewCheckBox.aspx

Thanks
Karthik
www.f5Debug.net

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 2/24/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
nice link Karthik :)

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 2/24/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Thanks naimish!!!

Thanks
Karthik
www.f5Debug.net

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response