My checkboxlist contains 3 items A,B,C.
If user checks A which is what i want then user will obtain 2 marks
else user obtains 0 marks
My problem is that whenever user checks more than 3 item, user is still able obtain 2 marks, whereas by rights user should obtain zero marks because user checked A,B,C?
so how to make that if user has checked more than 1 box in checkboxlist then user will obtain 0 marks
example
if(A==A){
//user obtain 2 marks
}else{
//user obtain 0 marks
}
dtr = cmd.ExecuteReader();
if (dtr.Read())
{
if (dtr["Answer"].ToString() == CheckBoxList1.Text.ToString())
{
Label2.Text = "2 marks";
}
else
{
Label2.Text = "0 marks";
}
}
else
{
Response.Write("db not read");
}
dtr.Close();
well, i figured out the answer, thanks for help=) every checked the numSelected will increase by 1,once numSelected more then 2,user will get 0marks