473,698 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

urgent - custom validator - ServerValidate function - problem

in my custom validator ServerValidate function i set
args.IsValid = False
but the page execution continues like the page is valid and the validation
summary doesn't show the error message .

how come?

and how should it work, if the args parameter is passed byval?
it won't go anywhere outside of the function scope isn't it?
is this a bug in vb.net because trying to set it to byref causes compilation
error,
or i'm missing here something?

please advise from your experience, i don't see how to solve this.
nothing special about the code, just setting the args.IsValid = False in the
ServerValidate function, in debug mode i see that the function is called,
what else to check?
i can't set the page.IsValid since it's read-only.
what i will point is that i'm overriding the validate method like that:

Public Overrides Sub Validate()
If bCheckSomethgin g Then
... update some fields.
End If

MyBase.Validate ()
End Sub

but it always calls the validate method - is there a problem the way it's
written?

TIA, z.
Nov 18 '05 #1
1 2233
there are 2 properties and 1 method required to be implemented by a server
validator

two props:

ErrorMessage
IsValid

1 method

Validate

the IsValid property you implement returns validation result.

-- bruce (sqlwork.com)

"z. f." <zi**@info-scopeREMSPAM.co .il> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
in my custom validator ServerValidate function i set
args.IsValid = False
but the page execution continues like the page is valid and the validation
summary doesn't show the error message .

how come?

and how should it work, if the args parameter is passed byval?
it won't go anywhere outside of the function scope isn't it?
is this a bug in vb.net because trying to set it to byref causes compilation error,
or i'm missing here something?

please advise from your experience, i don't see how to solve this.
nothing special about the code, just setting the args.IsValid = False in the ServerValidate function, in debug mode i see that the function is called,
what else to check?
i can't set the page.IsValid since it's read-only.
what i will point is that i'm overriding the validate method like that:

Public Overrides Sub Validate()
If bCheckSomethgin g Then
... update some fields.
End If

MyBase.Validate ()
End Sub

but it always calls the validate method - is there a problem the way it's
written?

TIA, z.

Nov 18 '05 #2

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

Similar topics

3
2359
by: simon | last post by:
I have 2 <asp:textbox controls>: <asp:textbox id="txt1" Runat="server" ></asp:textbox> <asp:textbox id="txt2" Runat="server" ></asp:textbox> User must insert the value either in txt1 OR in txt2, so one of them shouldn't be empty. So I use custom validator:
10
5484
by: Rigs | last post by:
Hi, I have a textbox with a Custom Validator that utilizes the OnServerValidate method for that textbox. This works fine, however the method only executes when data exists in that textbox after the Submit button is clicked. If I click the submit button and no data exists in the textbox, the OnServerValidate method does not fire. I'd like the OnServerValidate method to either execute every time the Submit button is clicked. I am...
5
2445
by: Richard Payne | last post by:
Hi This is probably a newbie question but I can't seem to find a clear answer to the problem I have. I have created a Custom Validator control on my webform that works fine, but when I put the control in to the header section of my datalist it doesn't work, the ServerValidate event doesn't fire. I presume that I haven't wirded it up correctly.
9
5160
by: Alex Shirley | last post by:
Hi there I’m simply trying to check for a blank or empty value in a textbox on my webform. In this instance I do not want to use a requiredfieldvalidator, I want to use a customvalidator (as I have other code within the customvalidator which works). This won’t work (within servervalidate): If txtBox.Text.ToString = "" Then raise exception…..
5
2922
by: Mattyw | last post by:
Hi, I'm relatively new to Web Forms, I have been using Required Field Validators and Regular Expression Validators on a Web Form I am developing and everything works as expected using Visual Studio.NET 2003 and VB code behind. I have a radio button and textbox, and basically i need the textbox to be required based on the user selecting "Yes" from the radio button. I've read through the newsgroups and found that a Custom Validator
3
8246
by: Andy | last post by:
Hi folks, I have a customvalidator control that works properly if it isn't contained in an ASP:TABLE. But, when I place it inside an ASP:TABLE, I find that _ServerValidate doesn't get fired, even if I force the customvalidator to validate by invoking its validate() method after a button is clicked: cvCustomValidator_ServerValidate(object source, system.Web.UI.WebControls.ServerValidateEventArgs args) <== doesn't get
8
3922
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
2
2083
by: tinariver | last post by:
I am using the onServerValidate of CutomValidator. I have got the Calender control and a text control. When user pick the date from calender conrol and value goes in the text box. Now I have to validate the value entered by the user to check if it is a valid Date and and if the date is in specific range. So I am trying to validate it on server side using onServerValidate, but for somereason the custom validator is not invoking my server...
5
1275
by: =?Utf-8?B?R2FyeSBMYXJpbWVy?= | last post by:
Created a Custom Validation Ctrl in EW2 to validate a text box entry. Want to make sure entry is evenly divisible by 7, and that value is not 0. However, args.IsValid = false, even if 77 is entered in text box. Tag and script that were added to page follow: <asp:CustomValidator id="CustomValidator1" runat="server" ClientValidationFunction="ClientValidateSerial3" ControlToValidate="SerialNumber3" Display="Dynamic" ErrorMessage="Entry...
0
8676
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9164
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
8870
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...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
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
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
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.