I want to dynamically add a checkbox to a dynamic GridView along with an Event.
i.e. For the grid I have to add check boxes dynamically checked or unchecked accord
I'm sorry, follow this
Place a check box in gridview
this is an example HTML Code to declare a checkbox in gridview
Now about the event for the checkbox
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
GridViewRow row = ((GridViewRow)((CheckBox)sender).NamingContainer);
int index = row.RowIndex;
CheckBox cb1 = (CheckBox)Gridview.Rows[index].FindControl("CheckBox1");
string checkboxstatus;
if (cb1.Checked == true)
checkboxstatus = "YES";
else if(cb1.Checked == false)
checkboxstatus = "NO";
//Here Write the code to connect to your database and update the status by
//sending the checkboxstatus as variable and update in the database.
}