Solved

C#: field validation: "does not contain a definition for 'Requiredfieldvalidator3'" ?

Posted on 2003-11-27
2
979 Views
Last Modified: 2008-02-07
Hoi all...
I have the following working code:
-----------------------------
<form id="Form1" method="post" runat="server">
<asp:ValidationSummary runat="server" HeaderText="Please correct the following errors:" ShowSummary="true"
      DisplayMode="BulletList" ID="Validationsummary1" />

Variable name:
<!--StartFragment -->
<asp:RequiredFieldValidator ControlToValidate="variableName" runat="server" ErrorMessage="Please enter a name for the variable." id="RequiredFieldValidator1">
      Enter a name for the variable.
</asp:RequiredFieldValidator>
<input id="variableName" style="WIDTH: 640px" type="text" runat="server"><br>
<br>
English:
<asp:RequiredFieldValidator ControlToValidate="txtEnglish" runat="server" ErrorMessage="English text is missing." id="Requiredfieldvalidator2">
      Please enter an english text.
</asp:requiredfieldvalidator><br>
<input type="text" id="txtEnglish" runat="server" style="WIDTH:640px" NAME="txtEnglish"><br>
<br>
<asp:button id="Button1" style="" runat="server" Text="Save" Width="144px"></asp:button>

</form>
-----------------------------


This works as it should.
If I add a new field with validation i get the error message:
"'ASP.multiLanguageEditVariable_aspx' does not contain a definition for 'Requiredfieldvalidator3'"

This is the new (and broken) code:


-----------------------------
<form id="Form1" method="post" runat="server">
<asp:ValidationSummary runat="server" HeaderText="Please correct the following errors:" ShowSummary="true"
      DisplayMode="BulletList" ID="Validationsummary1" />

Variable name:
<!--StartFragment -->
<asp:RequiredFieldValidator ControlToValidate="variableName" runat="server" ErrorMessage="Please enter a name for the variable." id="RequiredFieldValidator1">
      Enter a name for the variable.
</asp:RequiredFieldValidator>
<input id="variableName" style="WIDTH: 640px" type="text" runat="server"><br>
<br>
English:
<asp:RequiredFieldValidator ControlToValidate="txtEnglish" runat="server" ErrorMessage="English text is missing." id="Requiredfieldvalidator2">
      Please enter an english text.
</asp:requiredfieldvalidator><br>
<input type="text" id="txtEnglish" runat="server" style="WIDTH:640px" NAME="txtEnglish"><br>
<br>
German:
<asp:RequiredFieldValidator ControlToValidate="txtGerman" runat="server" ErrorMessage="German translation is missing." id="Requiredfieldvalidator3">
      Please enter a translation.
</asp:requiredfieldvalidator><br>
<input type="text" id="txtGerman" runat="server" style="WIDTH:640px" NAME="txtGerman"><br>
<br>
<asp:button id="Button1" style="" runat="server" Text="Save" Width="144px"></asp:button>

</form>
0
Comment
Question by:Smoerble
2 Comments
 

Accepted Solution

by:
atomicchip earned 125 total points
ID: 9832453
It looks like your RequiredFieldValidator3 (or is it Requiredfieldvalidator3 - as shown in your error) is not referenced properly in the code-behind. Check to make sure that there is a protected object named Requiredfieldvalidator3 declared in the code-behind. Also, make sure that the case used in the code-behind matches the case used in the aspx page.

Hope that helps,
DB
0
 

Author Comment

by:Smoerble
ID: 9836619
Yes, it helped, thank you.
125 credits for you :)
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question