hi ,
this is asha bhatt. i have one radiobuttonlist and checkboxlist and i want to do the validation for these in asp.net ,the validation part i know that
plz see my code
protected void SubmitButton_Click(object sender, EventArgs e)
{
bool flage = false;
bool valid = false;
try
{
if (Convert.ToInt32(dt.Rows[count][6]) == 1)
{
for (int j = 0; j < Rdboxlist.Items.Count; j++)
{
if (Rdboxlist.Items[j].Selected)
{
nextquestion();
valid = true;
}
}
if (!valid)
{
Response.Write("<script> confirm('You have not selected any answer.')</script>");
// Response.Write("<script> prompt('You have not selected any answer.')</script>");
nextquestion();
}
}
else if (Convert.ToInt32(dt.Rows[count][6]) > 1)
{
for (int i = 0; i < Chkboxlist.Items.Count; i++)
{
if (Chkboxlist.Items[i].Selected)
{
nextquestion();
flage = true;
}
}
if (!flage)
{
Response.Write("<script> confirm('You have not selected any answer.')</script>");
nextquestion();
}
}
}
catch (IndexOutOfRangeException ex)
{
Response.Write(ex.Message);
}
}
if my falge is not valid then i want to show message box with yes and no button in asp.net
plz help me...............................