Validation error: Unable to find control id referenced by the 'ControlToValidate' property

Validation error: Unable to find control id referenced by the 'ControlToValidate' property

Post by J. » Wed, 30 Oct 2002 07:46:08



Hello all,

I'm having problems with my validation. I have two textboxes, one
representing user name and one representing password in a login form, and
two validation controls to go with them. Problem is, the validation controls
cannot find the textboxes by ID. I get this error:

Unable to find control id 'bruger' referenced by the 'ControlToValidate'
property of 'brugerVal'.
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.HttpException: Unable to find control id
'bruger' referenced by the 'ControlToValidate' property of 'brugerVal'.

This is my relevant code:

Brugernavn:<br /> <asp:textbox CssClass="aspforms" name="bruger"
runat="server" TextMode="SingleLine" /> <br />
Kodeord:<br /> <asp:textbox CssClass="aspforms" ID="kodeord" runat="server"
TextMode="Password" />
<br /> <asp:button ID="logindknap" runat="server" Text="Log ind" />

and

<asp:requiredfieldvalidator ControlToValidate="bruger" Display="Dynamic"
ErrorMessage="Skriv et brugernavn!" ID="brugerVal" runat="server" /> <br />
<asp:requiredfieldvalidator ControlToValidate="kodeord" Display="Dynamic"
ErrorMessage="Skriv et kodeord!" ID="kodeordVal" runat="server" /> <br />

Please help me!

Thanks in advance,

J.

 
 
 

Validation error: Unable to find control id referenced by the 'ControlToValidate' property

Post by Ken Cox [Microsoft MVP » Wed, 30 Oct 2002 11:00:52


I don't see an ID value for the first textbox. I think that's what ASP.NET
wants to see (not the Name).

When I pasted the code into VS.NET, it added the ID value as Textbox1.

Does that fix it?

Ken

Hello all,

I'm having problems with my validation. I have two textboxes, one
representing user name and one representing password in a login form, and
two validation controls to go with them. Problem is, the validation controls
cannot find the textboxes by ID. I get this error:

Unable to find control id 'bruger' referenced by the 'ControlToValidate'
property of 'brugerVal'.
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.HttpException: Unable to find control id
'bruger' referenced by the 'ControlToValidate' property of 'brugerVal'.

This is my relevant code:

Brugernavn:<br /> <asp:textbox CssClass="aspforms" name="bruger"
runat="server" TextMode="SingleLine" /> <br />
Kodeord:<br /> <asp:textbox CssClass="aspforms" ID="kodeord" runat="server"
TextMode="Password" />
<br /> <asp:button ID="logindknap" runat="server" Text="Log ind" />

and

<asp:requiredfieldvalidator ControlToValidate="bruger" Display="Dynamic"
ErrorMessage="Skriv et brugernavn!" ID="brugerVal" runat="server" /> <br />
<asp:requiredfieldvalidator ControlToValidate="kodeord" Display="Dynamic"
ErrorMessage="Skriv et kodeord!" ID="kodeordVal" runat="server" /> <br />

Please help me!

Thanks in advance,

J.

 
 
 

Validation error: Unable to find control id referenced by the 'ControlToValidate' property

Post by Ken Cox [Microsoft MVP » Wed, 30 Oct 2002 12:02:00


It seems to work okay here. Maybe something is corrupt in your .resx file?  You
can delete it and rebuild.

For your reference, I've pasted in my code below.

Ken

'ctv.aspx

Inherits="p733workev.ctv"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>ctv</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
content="http://www.veryComputer.com/;>
  </head>
  <body ms_positioning="FlowLayout">
    <form id="Form1" method="post" runat="server">
      Brugernavn:<br>
      <asp:textbox cssclass="aspforms" runat="server" textmode="SingleLine"
id="bruger" />
      <asp:requiredfieldvalidator controltovalidate="bruger" display="Dynamic"
errormessage="Skriv et brugernavn!"
        id="brugerVal" runat="server" />
      <br>
      Kodeord:<br>
      <asp:textbox cssclass="aspforms" id="kodeord" runat="server"
textmode="Password" />
      <asp:requiredfieldvalidator controltovalidate="kodeord" display="Dynamic"
errormessage="Skriv et kodeord!" id="kodeordVal"
        runat="server" />
      <br>
      <asp:button id="logindknap" runat="server" text="Log ind" />
      <br>
      <br>
    </form>
  </body>
</html>

'ctv.asp.vb

Public Class ctv
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.De*StepThrough()> Private Sub
InitializeComponent()

  End Sub
  Protected WithEvents kodeord As System.Web.UI.WebControls.TextBox
  Protected WithEvents logindknap As System.Web.UI.WebControls.Button
  Protected WithEvents brugerVal As
System.Web.UI.WebControls.RequiredFieldValidator
  Protected WithEvents kodeordVal As
System.Web.UI.WebControls.RequiredFieldValidator
  Protected WithEvents bruger As System.Web.UI.WebControls.TextBox

    'NOTE: The following placeholder declaration is required by the Web Form
Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

  Private Sub logindknap_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles logindknap.Click

  End Sub
End Class

Actually, I made an error in my original post. Initially, my code had the ID
value set correctly. In an attempt of debuggin I changed the ID parameter to
Name, and forgot to change it back when I posted this.

Thanks for your input though. Any further advice would be great.

 - J.



> I don't see an ID value for the first textbox. I think that's what ASP.NET
> wants to see (not the Name).

> When I pasted the code into VS.NET, it added the ID value as Textbox1.

> Does that fix it?

> Ken




Quote:> Hello all,

> I'm having problems with my validation. I have two textboxes, one
> representing user name and one representing password in a login form, and
> two validation controls to go with them. Problem is, the validation
controls
> cannot find the textboxes by ID. I get this error:

> Unable to find control id 'bruger' referenced by the 'ControlToValidate'
> property of 'brugerVal'.
> 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.HttpException: Unable to find control id
> 'bruger' referenced by the 'ControlToValidate' property of 'brugerVal'.

> This is my relevant code:

> Brugernavn:<br /> <asp:textbox CssClass="aspforms" name="bruger"
> runat="server" TextMode="SingleLine" /> <br />
> Kodeord:<br /> <asp:textbox CssClass="aspforms" ID="kodeord"
runat="server"
> TextMode="Password" />
> <br /> <asp:button ID="logindknap" runat="server" Text="Log ind" />

> and

> <asp:requiredfieldvalidator ControlToValidate="bruger" Display="Dynamic"
> ErrorMessage="Skriv et brugernavn!" ID="brugerVal" runat="server" /> <br
/>
> <asp:requiredfieldvalidator ControlToValidate="kodeord" Display="Dynamic"
> ErrorMessage="Skriv et kodeord!" ID="kodeordVal" runat="server" /> <br />

> Please help me!

> Thanks in advance,

> J.

 
 
 

Validation error: Unable to find control id referenced by the 'ControlToValidate' property

Post by J. » Thu, 31 Oct 2002 10:23:51


I found the problem. I'm using DreamWeaver MX and it turns out that its
C#/ASP.NET code is completely out in the forest. I've taken care of the
problems manually - thanks for your help!

 - J.



> It seems to work okay here. Maybe something is corrupt in your .resx file?
You
> can delete it and rebuild.

> For your reference, I've pasted in my code below.

> Ken

> 'ctv.aspx

> Inherits="p733workev.ctv"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
>   <head>
>     <title>ctv</title>
>     <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
>     <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
>     <meta name="vs_defaultClientScript" content="JavaScript">
>     <meta name="vs_targetSchema"
> content="http://www.veryComputer.com/;>
>   </head>
>   <body ms_positioning="FlowLayout">
>     <form id="Form1" method="post" runat="server">
>       Brugernavn:<br>
>       <asp:textbox cssclass="aspforms" runat="server"

textmode="SingleLine"

- Show quoted text -

> id="bruger" />
>       <asp:requiredfieldvalidator controltovalidate="bruger"
display="Dynamic"
> errormessage="Skriv et brugernavn!"
>         id="brugerVal" runat="server" />
>       <br>
>       Kodeord:<br>
>       <asp:textbox cssclass="aspforms" id="kodeord" runat="server"
> textmode="Password" />
>       <asp:requiredfieldvalidator controltovalidate="kodeord"
display="Dynamic"
> errormessage="Skriv et kodeord!" id="kodeordVal"
>         runat="server" />
>       <br>
>       <asp:button id="logindknap" runat="server" text="Log ind" />
>       <br>
>       <br>
>     </form>
>   </body>
> </html>

> 'ctv.asp.vb

> Public Class ctv
>     Inherits System.Web.UI.Page

> #Region " Web Form Designer Generated Code "

>     'This call is required by the Web Form Designer.
>     <System.Diagnostics.De*StepThrough()> Private Sub
> InitializeComponent()

>   End Sub
>   Protected WithEvents kodeord As System.Web.UI.WebControls.TextBox
>   Protected WithEvents logindknap As System.Web.UI.WebControls.Button
>   Protected WithEvents brugerVal As
> System.Web.UI.WebControls.RequiredFieldValidator
>   Protected WithEvents kodeordVal As
> System.Web.UI.WebControls.RequiredFieldValidator
>   Protected WithEvents bruger As System.Web.UI.WebControls.TextBox

>     'NOTE: The following placeholder declaration is required by the Web
Form
> Designer.
>     'Do not delete or move it.
>     Private designerPlaceholderDeclaration As System.Object

>     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Init
>         'CODEGEN: This method call is required by the Web Form Designer
>         'Do not modify it using the code editor.
>         InitializeComponent()
>     End Sub

> #End Region

>     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>         'Put user code to initialize the page here
>     End Sub

>   Private Sub logindknap_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles logindknap.Click

>   End Sub
> End Class




- Show quoted text -

> Actually, I made an error in my original post. Initially, my code had the
ID
> value set correctly. In an attempt of debuggin I changed the ID parameter
to
> Name, and forgot to change it back when I posted this.

> Thanks for your input though. Any further advice would be great.

>  - J.



> > I don't see an ID value for the first textbox. I think that's what
ASP.NET
> > wants to see (not the Name).

> > When I pasted the code into VS.NET, it added the ID value as Textbox1.

> > Does that fix it?

> > Ken



> > Hello all,

> > I'm having problems with my validation. I have two textboxes, one
> > representing user name and one representing password in a login form,
and
> > two validation controls to go with them. Problem is, the validation
> controls
> > cannot find the textboxes by ID. I get this error:

> > Unable to find control id 'bruger' referenced by the 'ControlToValidate'
> > property of 'brugerVal'.
> > 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.HttpException: Unable to find control id
> > 'bruger' referenced by the 'ControlToValidate' property of 'brugerVal'.

> > This is my relevant code:

> > Brugernavn:<br /> <asp:textbox CssClass="aspforms" name="bruger"
> > runat="server" TextMode="SingleLine" /> <br />
> > Kodeord:<br /> <asp:textbox CssClass="aspforms" ID="kodeord"
> runat="server"
> > TextMode="Password" />
> > <br /> <asp:button ID="logindknap" runat="server" Text="Log ind" />

> > and

> > <asp:requiredfieldvalidator ControlToValidate="bruger" Display="Dynamic"
> > ErrorMessage="Skriv et brugernavn!" ID="brugerVal" runat="server" /> <br
> />
> > <asp:requiredfieldvalidator ControlToValidate="kodeord"
Display="Dynamic"
> > ErrorMessage="Skriv et kodeord!" ID="kodeordVal" runat="server" /> <br
/>

> > Please help me!

> > Thanks in advance,

> > J.

 
 
 

1. Validation------"Warning!Unable to find script libruary 'WebUIValidation.js'

I've made some Validator in the .aspx file
but when the browser load the file
a message box popup "Warning! Unable to find script libruary 'WebUIValidation.js'
The browser is IE5.5 thus client side validation shoud be carry out........
I tried to find the WebUIValidation.js file in my IIS 5 (windows 2K server)
but i could find nothing.........what's the problem?
Anyone has an idea?
and where can I get back the file "WebUIValidation.js".......
Thanks.

linus

2. how to creat a ramdisk or ram-drive in win2k pro??

3. Composite Control Prob - Multiple controls with the same ID '_ctl0' were found

4. Kaysa Retro Computers. All your retro needs at less than eBay prices!

5. Newbie ControlToValidate property of '' cannot be blank.

6. ActiveSync Problem/Question

7. Update unable to find TableMapping['Table'] or DataTable 'Table'.

8. Were is a Good place to start?

9. Update unable to find TableMapping['Table'] or DataTable 'Table'

10. ODBC driver error '80004005' - couldn't find file '(unknown)'

11. using property 'find' in a RichTextBox Control

12. .aspx error: Could not find any attribute 'class' of element 'td'.