How do i set the checkbox (template) of a gridview programmatically in the code view
this is the code pasted in the code behind:
but it doesnt work ....
please help ...
int i = 0;
foreach (GridViewRow row in Grid_Reserve.Rows)
{
i = i + 1;
CheckBox checkbox = row.FindControl("CheckBox1") as CheckBox;
string str = " select count(*) from Issue_Book_Reserve, Books where Issue_Book_Reserve.Book_Id = Books.Book_Id and Books.Book_Name = '" + Grid_Issue.Rows[i].Cells[2].Text + "' and Issue_Book_Reserve.Issue_Book_Reserve_State = 3";
SqlCommand checking = new SqlCommand(str, con);
int count = (int)checking.ExecuteScalar();
if (count < 1)
Grid_Issue.Rows[i].Cells[0].Text = "true";
// checkbox.Checked = true; //in case i use this , a null pointer exception is used
}
}