Home All Groups Group Topic Archive Search About

RequiredFieldvalidator displays error too early

Author
23 Oct 2007 9:47 PM
Preben Zacho
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>

Author
24 Oct 2007 5:41 AM
Mansi Shah
HI Preben,

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


Regards,
Mansi Shah.

*** Sent via Developersdex http://www.developersdex.com ***
Author
24 Oct 2007 12:47 PM
N
I will rather check if there is already a control on the page that is
causing auto post back.

Show quote
"Mansi Shah" <ma***@devdex.com> wrote in message
news:uiFvSCgFIHA.4228@TK2MSFTNGP02.phx.gbl...
>
> HI Preben,
>
> You can chceck it by setting "AutoPostBack" property of textbox to
> "true", if it can help your coding logic..
>
>
> Regards,
> Mansi Shah.
>
> *** Sent via Developersdex http://www.developersdex.com ***
Author
25 Oct 2007 7:34 AM
Preben Zacho
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?


Show quote
"N" <nko***@glgroup.com> wrote in message
news:OEY1XMkFIHA.2004@TK2MSFTNGP06.phx.gbl...
>I will rather check if there is already a control on the page that is
>causing auto post back.
>
> "Mansi Shah" <ma***@devdex.com> wrote in message
> news:uiFvSCgFIHA.4228@TK2MSFTNGP02.phx.gbl...
>>
>> HI Preben,
>>
>> You can chceck it by setting "AutoPostBack" property of textbox to
>> "true", if it can help your coding logic..
>>
>>
>> Regards,
>> Mansi Shah.
>>
>> *** Sent via Developersdex http://www.developersdex.com ***
>
>
Author
30 Oct 2007 8:45 PM
john123
Why not set the ValidationGroup property of the textbox so the validation occurs only when the according button is pressed?


Show quote
>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?
>
>
>"N" <nko***@glgroup.com> wrote in message
>news:OEY1XMkFIHA.2004@TK2MSFTNGP06.phx.gbl...
>>I will rather check if there is already a control on the page that is
>>causing auto post back.
>>
>> "Mansi Shah" <ma***@devdex.com> wrote in message
>> news:uiFvSCgFIHA.4228@TK2MSFTNGP02.phx.gbl...
>>>
>>> HI Preben,
>>>
>>> You can chceck it by setting "AutoPostBack" property of textbox to
>>> "true", if it can help your coding logic..
>>>
>>>
>>> Regards,
>>> Mansi Shah.
>>>
>>> *** Sent via Developersdex http://www.developersdex.com ***
>>
>>
>
>
>

AddThis Social Bookmark Button