|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RequiredFieldvalidator displays error too earlyHi 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> 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 *** 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 *** 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 *** > > 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 *** >> >> > > > |
|||||||||||||||||||||||