473,657 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

customvalidator problem

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 'ControlToValid ate' 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.

Exception Details: System.Web.Http Exception: Unable to
find control id 'lstRider' referenced by
the 'ControlToValid ate' property of 'cvRiders'
Here is part of my HTML that is of concern:
<asp:TemplateCo lumn HeaderText="Rid ers">

<ItemTemplate >

<asp:listbox AutoPostBack="F alse"
BackColor="#fff fff" id="lstRider" runat="server" Rows="1"
DataSource="<%# DsRider1 %>" Enabled="True"
SelectionMode=" Multiple" DataTextField=" UserName"
DataValueField= "UserID" />

</asp:listbox>

</ItemTemplate>

</asp:TemplateCol umn>
</asp:datagrid><a sp:customvalida tor id="cvRiders" style="Z-
INDEX: 104; LEFT: 136px; POSITION: absolute; TOP: 88px"
runat="server"
display="Static "
OnServerValidat e="lstRiderVali dation" ErrorMessage="R iders
has a maximum selection of 2"
ControlToValida te="lstRider"> </asp:customvalid ator>
This is what I have in my code-behind:

Sub lstRiderValidat ion(ByVal source As Object, ByVal
arguments As ServerValidateE ventArgs) Handles
cvRiders.Server Validate

Dim strSelectionArr ay() As String =
arguments.Value .Split(",")

If strSelectionArr ay(2).Length > 0 Then 'Max 2
selections
arguments.IsVal id = False
Else
arguments.IsVal id = True
End If

End Sub

How can I get the customvalidator to recognize my control?
I know it's probably because the control is an
itemtemplate...
Nov 17 '05 #1
1 2014
The ControlToValida te property is not required for custom validators. Leave
it blank.

"bill yeager" <ws********@msn .com> wrote in message
news:0d******** *************** *****@phx.gbl.. .
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 'ControlToValid ate' 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.

Exception Details: System.Web.Http Exception: Unable to
find control id 'lstRider' referenced by
the 'ControlToValid ate' property of 'cvRiders'
Here is part of my HTML that is of concern:
<asp:TemplateCo lumn HeaderText="Rid ers">

<ItemTemplate >

<asp:listbox AutoPostBack="F alse"
BackColor="#fff fff" id="lstRider" runat="server" Rows="1"
DataSource="<%# DsRider1 %>" Enabled="True"
SelectionMode=" Multiple" DataTextField=" UserName"
DataValueField= "UserID" />

</asp:listbox>

</ItemTemplate>

</asp:TemplateCol umn>
</asp:datagrid><a sp:customvalida tor id="cvRiders" style="Z-
INDEX: 104; LEFT: 136px; POSITION: absolute; TOP: 88px"
runat="server"
display="Static "
OnServerValidat e="lstRiderVali dation" ErrorMessage="R iders
has a maximum selection of 2"
ControlToValida te="lstRider"> </asp:customvalid ator>
This is what I have in my code-behind:

Sub lstRiderValidat ion(ByVal source As Object, ByVal
arguments As ServerValidateE ventArgs) Handles
cvRiders.Server Validate

Dim strSelectionArr ay() As String =
arguments.Value .Split(",")

If strSelectionArr ay(2).Length > 0 Then 'Max 2
selections
arguments.IsVal id = False
Else
arguments.IsVal id = True
End If

End Sub

How can I get the customvalidator to recognize my control?
I know it's probably because the control is an
itemtemplate...

Nov 17 '05 #2

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

Similar topics

7
2170
by: jcpmeticulus | last post by:
Hi I've spent the last day or so debugging a problem with a CustomValidator and am now totally stumped! Basically I use a number of CustomValidator's on my page, but have cut this down now to only 2. When the page is first loaded the CustomValidator are made and the generated HTML contains both of them. When the "Apply" button is clicked the page is posted back and my database is updated. The page is then rebuilt and sent back to the...
2
6043
by: George Ter-Saakov | last post by:
Hi. I am fighting the CustomValidator strange behavior for second day already. I created some test project which is only to reproduce the problem. 1. I created UserControl which has an only a Custom Validator 2. in UserControl::Page_Load i set CustomValidator1.IsValid = false; 3. I insert the User Control into the page and have a submit button there.
10
4755
by: Mr. x | last post by:
Hello, I have some code as follows. It seems that customValidator doesn't work - because i don't get any message. In the body : <asp:table> <asp:TableRow>
2
2408
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
1751
by: Ronan Dodworth | last post by:
Hi there I'm having a little bit of a problem with my customvalidator control. The problem is the javascript runs fine on my local webserver IIS but not when I post it to the web hosting server. As it is client side scripting I'm suprised that this is the case as I'm using the same browser IE6 and the same machine to access both. I've included the code below. Can anyone help . I've tried lowering all the security settings for intranet...
3
1849
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
1825
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.
2
1957
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...
2
1334
by: testemailsystem.test | last post by:
Hi everyone, I use CustomValidator with the server event onservervalidate (no javascript event). The scenario : The user filled the form and pressed SUBMIT. But because there was an error – the error message of the CustomValidator was shown. The user fixed the error and pressed SUBMIT – this time he is transferred to the second page.
0
8385
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...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
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
7316
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
6162
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
5632
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
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
1601
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.