473,762 Members | 6,675 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BaseValidator Custom Validator validating on a Repeater

Hi All,

I have a repeater that required a check box on each item in the repeater to
be validated against eachother (to check if only one item's checkbox is
ticked.) To perform this validation I created a validation control that
inherits from BaseValidator and performs server and client side checks and is
performing the validation on the repeater control.

The above all works except I cant get the client validation to stop the page
from submitting - it does not call the validation function for the control.

I have added code such as:

AddAttributesTo Render { ...

writer.AddAttri bute("evaluatio nfunction", "CheckAllCheckB oxes" +
this.ClientID);

....
}

or

RegisterValidat orDeclaration {

...

string element = "document.getEl ementById(\"" + this.ClientID + "\")";
Page.RegisterAr rayDeclaration( "Page_Validator s", element);
...

}

Neither seem to enable the client script to be run when the submit button is
pressed.

Please help
Aug 17 '06 #1
1 2464
UPDATE:

OK, I have added both the code below and can see the validation occuring
when I click submit on the form. The reason it's not validating now is that
val.enabled in the asp.net javascript validation always returns false (where
val is the validation control.) I have done Enabled=true in the aspx and also
tried addAttribute("e nabled","true") - neither work - it always comes up with
val.enabled = false.

Any other ideas?

"criz" wrote:
Hi All,

I have a repeater that required a check box on each item in the repeater to
be validated against eachother (to check if only one item's checkbox is
ticked.) To perform this validation I created a validation control that
inherits from BaseValidator and performs server and client side checks and is
performing the validation on the repeater control.

The above all works except I cant get the client validation to stop the page
from submitting - it does not call the validation function for the control.

I have added code such as:

AddAttributesTo Render { ...

writer.AddAttri bute("evaluatio nfunction", "CheckAllCheckB oxes" +
this.ClientID);

...
}

or

RegisterValidat orDeclaration {

..

string element = "document.getEl ementById(\"" + this.ClientID + "\")";
Page.RegisterAr rayDeclaration( "Page_Validator s", element);
..

}

Neither seem to enable the client script to be run when the submit button is
pressed.

Please help
Aug 17 '06 #2

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

Similar topics

9
12476
by: Leona | last post by:
Hello all, does anyone know of a tool, preferably free, preferably on linux, which will take an xml file and validate it against your own custom W3C XML Schema file (.xsd) ?? All help appreciated - it's proving very difficult to find. Failing that, does anyone know how to get the W3C's own online validating engine (XSV, I think it's called) to do the same job? I can't get it to do what I want and I can't really understand the output.
2
380
by: Evgueni | last post by:
Hello, I am new to .NET, and a custom validator is giving me a lot of grief. I want to use a Custom Validation control and for some reasons it's not firing the validation procedure. I am using .NET framework 1.0 Here is the declaration of the control <asp:CustomValidator id="CustomValidator1" style="Z-INDEX: 103; LEFT: 304px; POSITION: absolute; TOP: 408px" runat="server" ErrorMessage="Bad input -- please correct"...
1
1754
by: philipl | last post by:
hi, i have a datagrid which display custom controls when user clicks edit, changing data. I am using customvalidator to validate this control. I can get validation of user input to work no problem when user clicks on update in datagrid. My problem is that when I try to get customvalidation to work when user changes the value in the control, as i want this to be checked as soon as user changes the control. The custom control offers an
5
2448
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.
2
3252
by: Jerrad | last post by:
I have a textbox and a button within a repeater. The OnItemCommand sub of the repeater looks like this: Sub RepeaterButtonSub(ByVal source As Object, ByVal e As RepeaterCommandEventArgs) Dim RejectTxt As TextBox = CType(e.Item.FindControl("txtRejectNote"), TextBox) RejectButton(New Guid(e.CommandArgument.ToString), RejectTxt.Text) End Sub
3
8249
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
0
829
by: Sri Prasad Tadimalla | last post by:
I have a group of Validators inheriting from BaseValidator on my page. The Display property is set to None for all of them. I use the validator to change the label of the control I'm validating to red and show the error message as a tooltip when hovering over the label. Everything works fine until I do a postback, after that all the validation messages are displayed instead of being hidden. I am not sure why the Display property is...
1
4584
by: Rory Becker | last post by:
Hi All It's been a while since I tried anything like this and it's just driving me nuts.. I want to have simple templated repeater which contains (Per item) a Label, a textbox and a CustomValidator. Below the Repleater is a single button witha serverside function which changes the text of the button.
0
9554
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
9377
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
9811
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
8814
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...
1
7358
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
6640
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
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
3
2788
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.