Solved

How to do Page Validation?

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

624 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