jcraun
asked on
How to do Page Validation?
Hi Experts!
I think this is a fairly simple question but I am not sure of the best way to do it. I have required field and expression validators on all of my user input text boxes on a form. The validators fire upon clicking a SUBMIT button which has "causes validation" set to true. I currently display a * next to any required field that was missed by using the required field validators but I would also like to display a label or message box if any of the validators fire that tells the user to re-check the form for missed fields.
my thoughts were something like this:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Page.IsValid Then
'Insert data
else
lblError.visible = true
end Sub
I may not understand the correct way to use Page.IsValid or if anyone has a better way to do this please let me know..
Thanks!!
I think this is a fairly simple question but I am not sure of the best way to do it. I have required field and expression validators on all of my user input text boxes on a form. The validators fire upon clicking a SUBMIT button which has "causes validation" set to true. I currently display a * next to any required field that was missed by using the required field validators but I would also like to display a label or message box if any of the validators fire that tells the user to re-check the form for missed fields.
my thoughts were something like this:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Page.IsValid Then
'Insert data
else
lblError.visible = true
end Sub
I may not understand the correct way to use Page.IsValid or if anyone has a better way to do this please let me know..
Thanks!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.