> Hi
> Could you plzz ellaborate the exact problem that you are facing
> could you give the code of your routine submit_click
Protected Sub submit_Click(sender As Object, ByVal e As System.EventArgs)
Handles submit.Click
Dim checked as Boolean
checked = ValidateCheckBoxes()
If Not checked Then
errorMessage.Text = "Checkbox not set"
Else
errorMessage.Text = ""
End If
End Sub
The exact code inside the routine is irrelevent. I put those two lines in
this post to indicate that set a breakpoint at the "checked =" line. It
doesn't hit that line on the second try.
The first time I click the submit button, it stops at the breakpoint, then
calls the ValidateCheckBoxes function returning False. It sets the
errorMessage control's text value. I then, in the form, set one of the
check boxes that is to be validated so that it should then return True when
I resubmit. I again click the submit button but it doesn't break at the
"checked =" line. Nothing happens.
Shelly
Nishant Rana - 19 Sep 2007 16:14 GMT
Hi
I tried replication the scenario using a sample aspx
page with
2 checkboxes and a button
with a label for displaying error msg
In my case it was working fine
this is the code
protected void Button1_Click(object sender, EventArgs e)
{
Boolean check;
check = ValidateCheckBoxes();
if(check == true)
{
Label1.Text = "Checkbox not set";
}
else
{
Label1.Text = "";
}
}
private bool ValidateCheckBoxes()
{
if(CheckBox1.Checked == false && CheckBox2.Checked == false)
{
return true;
}
else
{
return false;
}
}
Shelly - 19 Sep 2007 16:44 GMT
Yes, it SHOULD work. That is why I posted it. It works the FIRST time I
clicked, but not the SECOND time. What could have happened in there so that
it doesn't fire the click event the second time?
> Hi
> I tried replication the scenario using a sample aspx
[quoted text clipped - 35 lines]
> }
> }
Shelly - 19 Sep 2007 16:49 GMT
I have other events on the page that cause a refresh of the page. It seems
that if I fire one of those, then the submit button will fire, I only
doesn't seem to fire when the previous event was from that submit button.
(The other event I have on this page is an OnTextChanged event for one of
the other fields. If I change the value in that field and go to another
field, it fires the event, the page refreshes with information for several
fields using the changed value as the basis, and then I can fire the submit
button. Once that button is fired, however, it won't fire a second time.