Solved

How to do Page Validation?

Posted on 2004-08-31
2
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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