473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

CustomValidator Control

Vi
Hi,
I have a TextBox, Button and CustomValidator web controls on an aspx page.
When a user clicks the Button, I want to perform server side validation of
the textbox with the method specified in the CustomValidator control.
When the validation fails, I'm setting the args.IsValid=false; so it will
display the message on the page, but the application does not stop and
continues and executes the Button click EventHandler.
How can I stop the execution of the page after the validation fails?
Thank you.
Nov 18 '05 #1
1 1589
It's one of those unfortunate quirks that client side validation will
stop a client's POST operation dead in it's tracks, but server side
validation requires your code to explicitly check Page.IsValid and
branch away from the typical flow of execution.

In other words, you probably want to wrap your logic in the button
click event with:

if(Page.IsValid)
{

}

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 20 Oct 2004 20:55:01 -0700, "Vi"
<Vi@discussions.microsoft.com> wrote:
Hi,
I have a TextBox, Button and CustomValidator web controls on an aspx page.
When a user clicks the Button, I want to perform server side validation of
the textbox with the method specified in the CustomValidator control.
When the validation fails, I'm setting the args.IsValid=false; so it will
display the message on the page, but the application do not stop and
continues and executes the Button click EventHandler.
How can I stop the execution of the page after the validation fails?
Thank you.


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jose Fernandez | last post by:
Hola I have this customvalidator <asp:CustomValidator id="ComboValidator" runat="server" ErrorMessage="CustomValidator" /> (The OnServerValidate method is set in Events windows of the Control...
1
by: bill yeager | last post by:
I'm using the customvalidator in my web page. I get the following error when I try to run the web page: Unable to find control id 'lstRider' referenced by the 'ControlToValidate' property of...
1
by: Jim Heavey | last post by:
Hello, I was am wanting to validate that a user has made a selection from a dropdownlist control in a datagrid. Is my only option to use a "CustomValidator Control"? I am not quite sure how to...
0
by: Jim Heavey | last post by:
Hello, I have added a "CustomValidator" control in in code to a control which is already on the footer. I am running the validation for the control at the server. My problem is that when the...
1
by: Dan Sikorsky | last post by:
I'm getting the following message when I try to add a CustomValidator control to the ValidationSummary to display an error message at runtime, and displaying ex.message in AddValidationControl...
0
by: ghafranabbas | last post by:
This is how you use the customvalidator control in any INamingContainer interface control (Datagrid, DataList, DataRepeater, etc). 1. In the ItemTemplate, place your customvalidator 2. Set the...
1
by: Nathan Sokalski | last post by:
I want to make sure that the SelectedDate property of the Calendar control is later than the current date or that a certain checkbox is selected. I tried to use a CustomValidator control with the...
1
by: David | last post by:
I need help with CustomValidator in 1.1. I added the CustomValidator control and code as per the doc., (See below) However, the code is never executed. Is there an extra switch or setting to...
3
by: Stan SR | last post by:
Hi, I have a web user control that contains 3 dropdownlists it's a date selector, so one contains the days, one the months and the last the years. Each of them starts with a blank value. I...
2
by: Mr. X. | last post by:
Hello. How can I control the position of customValidator. I have code like this (ASP.NET) <asp:CustomValidator dir = "rtl" CHARSET=WINDOWS-1255" id = "email_err" ControlToValidate="a_email"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.