Groups | Blog | Home
all groups > c# > october 2007 >

c# : RequiredFieldvalidator displays error too early


Preben Zacho
10/23/2007 11:45:56 PM
Hi there

I have a RequiredFieldValidator that displays the text "Required field" for
a textbox. The problem is, that the text "Required field" is displayed
BEFORE the user presses the button to accept the form. Why does this occure?
Must be some setting I've missed, cause in other forms it works as it
should, where the text is not displayed until the user click the accept
button.

My textbox and validator looks like this:

<asp:TextBox ID="tbFirstName" runat="server"
Width="204px"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqFirstNameUser"
runat="server" ControlToValidate="tbFirstName"
Enabled="True" ErrorMessage="Required field"
Display="Dynamic">
</asp:RequiredFieldValidator>
Preben Zacho
10/23/2007 11:49:20 PM
Sorry, this was posted to the wrong NG. I have posted it to the
aspnet.webcontrols NG instead, so just ignore this post.

[quoted text, click to view]
AddThis Social Bookmark Button