Click here to Skip to main content
15,887,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi developers,

i am using grid view to display the student name and besides that i put a check box.
when page loads all data will be filled in the grid view.

if we checked the check boxs in the gridview,and click on the Promote button which is out side the grid view,

the checkd box students must be promoted to next class.

like if i check any check box, who studies the 8th class,in the data base his class should be updated as 9th class.

how do i get?

Thank u.

Regards,
Thiru
Posted

On the click of promote button, iterate the gridview and find the checkbox control in the row as following.


foreach (GridViewRow row in GridViewStudent.Rows) 
                { 
                   CheckBox Chk = (CheckBox)row.FindControl("checkbox1"); 
                   if (Chk.Checked) 
                   {
                   // Find the id of the student similarly how we found the checkbox, your id can be in a hidden field or on label. Find that control by its id and get the value..
                   //Make an update call to the database
                    } 
                }
 
Share this answer
 
If you are looking for information on how to update data, see here[^].
 
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