Solved

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

Posted on 2003-11-27
2
956 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now