Set break points on these lines
str = ((Label)GridView1.Rows[i].Cells[1].FindControl("lblRollNo")).Text;
and
CheckBox chk = (CheckBox)GridView1.FindControl("chkboxSelect");
You will probably find that the return value from the method
FindControl
is null sometimes.
A better approach is is to do ,for example, like this:
Control control = GridView1.Rows[i].Cells[1].FindControl("lblRollNo");
if (control != null)
str = (control as Label).Text;