hi im adding checkbox controls dynamically in asp.net gridview like this
' CheckBox cb1 = new CheckBox();
cb1.Text = row.Cells[3].Text;
row.Cells[3].Controls.Add(cb1);
and i want to access that checkbox is checked or not on button click event....
Any one Help me...
on button click i am try this
foreach (GridViewRow item in grdreport.Rows)
{
if (item.RowType == DataControlRowType.DataRow)
{
CheckBox checkbox1 = (CheckBox)item.FindControl("cb1");
// cb1.Checked = true;
if (checkbox1.Checked)
{
}
}
}
but it gives me error Object reference not set to an instance of an object cb1 value is null
Aucun commentaire:
Enregistrer un commentaire