Solved

How to do Page Validation?

Posted on 2004-08-31
2
203 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 200 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 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