Click here to Skip to main content
15,937,127 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi all,

really need help .. ive insert checkbox in my gridview. and tryin to change some data in the database according to the checkbox that being selected. Really need help please...

At your aspx.cs try below code:

foreach (GridViewRow gridrow in GridView1.Rows)
           CheckBox cb = (CheckBox)gridrow.FindControl("MovieSelector");
           if (cb != null && cb.Checked)
               string obj = gridrow.Cells[2].Text;
               totalId = totalId + ","+ obj;

this was you can work on every row for which check box is checkedand can update database with required details.

gridrow.Cells[] gives you the value of corresponding column in gridview.

Hope this helped !

Share this answer
If you want to catch CellContentClick of the Grid then you must use CurrentCellDirtyStateChanged event to commit the changes. Please follow the above link if ur facing same problem :).

<a href="">
Share this answer
Ok! forget about google/bing... just go through this and i am sure you will find enough material:[^] :thumbsup:
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900