Look at your code:
protected void btnsubmit_Click(object sender, EventArgs e)
{
string strSelectOptions = string.Empty;
CheckBox ch = sender as CheckBox;
if (ch.Checked)
hat is a button click event handler, so the chances are that the
sender
is a button, not a CheckBox.
So this line:
CheckBox ch = sender as CheckBox;
will set
ch
to
null
, and any attempt to use a property or method will fail with a null reference exception.
Probably, you need to re-think what you are doing, or use the CheckBox name directly instead of trying to use the
sender
parameter.