Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to do Page Validation?

Posted on 2004-08-31
2
Medium Priority
?
220 Views
Last Modified: 2010-04-23
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!!
0
Comment
Question by:jcraun
2 Comments
 
LVL 8

Accepted Solution

by:
thrill_house earned 600 total points
ID: 11945056
You can actually do it rather easy by adding a Validation Summary control.

Just add this to your html side: <asp:ValidationSummary id="ValidationSummary1" runat="server" ShowSummary="False" ShowMessageBox="True"></asp:ValidationSummary>

Now the error messages will show up in a message box as well as put the * next to the problem.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question