Groups | Blog | Home
all groups > asp.net webcontrols > october 2007 >

asp.net webcontrols : RequiredFieldvalidator displays error too early


Mansi Shah
10/23/2007 10:41:48 PM

HI Preben,

You can chceck it by setting "AutoPostBack" property of textbox to
"true", if it can help your coding logic..


Regards,
Mansi Shah.

Preben Zacho
10/23/2007 11:47:54 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>
N
10/24/2007 8:47:12 AM
I will rather check if there is already a control on the page that is
causing auto post back.

[quoted text, click to view]

Preben Zacho
10/25/2007 12:00:00 AM
Well, I have another control in the form where AutoPostBack="True" (a text
box for searching).

Exactly when is this type of validation executed? And how do I then override
it, so the text is not written before the accept button is triggered?


[quoted text, click to view]
john123
10/30/2007 9:45:25 PM
Why not set the ValidationGroup property of the textbox so the validation occurs only when the according button is pressed?


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