473,739 Members | 4,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with CustomValidator in 1.1

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 force the
OnServerValidat e code to execute?


<asp:CustomVali dator id="CustomValid ator1" runat="server"
ErrorMessage="C ustomValidator" ControlToValida te="TextBox1"
OnServerValidat e="val01"></asp:CustomValid ator></P>

protected void val01(object source,
System.Web.UI.W ebControls.Serv erValidateEvent Args args)
{
args.IsValid = false;
}

Jun 19 '06 #1
1 1360

"David" <dm***@sbcgloba l.net> wrote in message
news:u2******** *************** *********@4ax.c om...
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 force the
OnServerValidat e code to execute?


<asp:CustomVali dator id="CustomValid ator1" runat="server"
ErrorMessage="C ustomValidator" ControlToValida te="TextBox1"
OnServerValidat e="val01"></asp:CustomValid ator></P>

protected void val01(object source,
System.Web.UI.W ebControls.Serv erValidateEvent Args args)
{
args.IsValid = false;
}

try adding causevalidation ="true" to your submit image or button control

Mike
Jun 20 '06 #2

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

Similar topics

7
2171
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require. Below is the script I currently use and what it does along with what I would like it to do. Can someone please help me work how I can fix this. <script> function ValidateDropDownOrCheckBox(sender, args) { if ( document.forms.DropDownList1.value...
1
2019
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 'cvRiders'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
2
2412
by: Stephen Miller | last post by:
Can the CustomValidator be used to simply report unexpected errors, without requiring Client/Server validation? To explain, say you had a simple text box and button that did a Full-text Search of a Catalogue in SQL. Malformed search requests can generate a variety of errors, which I simply want to catch, set the CustomValidator's IsValid method to false and assign the ErrorMessage to the CustomValidator's Message property. For example: ...
3
1858
by: philipl | last post by:
hi, i have a textbox in my edititemtemplate in my datagrid. I have created a customvalidator for it, when i update the row the appropiate function gets called to customvalidate but the problem is that the error message in my customvalidator does not get printed in the datagrid even though I have set the isvalid property in the server function to false. Does anyone know why this is? Here is the code snippets:
1
1847
by: SMG | last post by:
Hi All. My forms has two textboxes, 1 username, 2 password. Both has requiredfield validator it works fine when there is no input in these textboxes. And the errorMsg is shown in ValidationSummary. Now I want to check the username should contain only chatacters, ( I want to use customvalidator), when i enter char+number it trap the event of customvalidator but it doesn't show the errormsg in the customValidator and submits the form.
0
3537
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 OnServerValidate property of the customvalidator 3. Get reference to the Data Item object (For DataList is DataListItem, for DataGrid its DataGridItem) 4. Get reference to any controls needed for validation 5. Perform the validation
1
2491
by: Beffmans | last post by:
Hi I have defined an customvalidator on my TextBox: function clientvalidate(source, arguments){ { // even number? if (arguments.Value%2 == 0) arguments.IsValid = true; else
3
3537
by: Rich Squid | last post by:
Hello Here's my basic problem: On my asp.net form page I have a DetailsView (default mode=edit) bound to a AccessDataSource control. Users can successfuly update a databound template field, but I wanted to add a custom validator to check that the account number they are entering exists in a table in the Access Database.
2
1963
by: Jeff | last post by:
hey net 3.5 I have problem with a customvalidator. I enter values into the TextBox named "txt" and clicks on the save button (ibSave) then the TestValidate method get triggered. TestValidate set args.IsValid = false and the customvalidator displays an error on the webpage. The problem is that when I check in the database, the value has still been added to the database. if the value entered in the TextBox is not a correct value, then...
0
8792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.