RequiredFieldvalidator displays error too early

Discussion in 'ASP .Net Web Controls' started by Preben Zacho, Oct 23, 2007.

  1. Preben Zacho

    Preben Zacho Guest

    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, Oct 23, 2007
    #1
    1. Advertising

  2. Preben Zacho

    Mansi Shah Guest

    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 ***
     
    Mansi Shah, Oct 24, 2007
    #2
    1. Advertising

  3. Preben Zacho

    N Guest

    I will rather check if there is already a control on the page that is
    causing auto post back.

    "Mansi Shah" <> wrote in message
    news:...
    >
    > 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 ***
     
    N, Oct 24, 2007
    #3
  4. Preben Zacho

    Preben Zacho Guest

    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" <> wrote in message
    news:...
    >I will rather check if there is already a control on the page that is
    >causing auto post back.
    >
    > "Mansi Shah" <> wrote in message
    > news:...
    >>
    >> 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 ***

    >
    >
     
    Preben Zacho, Oct 25, 2007
    #4
  5. Preben Zacho

    john123 Guest

    Why not set the ValidationGroup property of the textbox so the validation occurs only when the according button is pressed?


    >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" <> wrote in message
    >news:...
    >>I will rather check if there is already a control on the page that is
    >>causing auto post back.
    >>
    >> "Mansi Shah" <> wrote in message
    >> news:...
    >>>
    >>> 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 ***

    >>
    >>

    >
    >
    >
     
    john123, Oct 30, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kostia

    Sesson_End called too early

    Kostia, Oct 21, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    436
    Kostia Grebelsky
    Oct 21, 2004
  2. Chumley Walrus
    Replies:
    1
    Views:
    12,233
    =?Utf-8?B?QnJpYW4gQnJvd24=?=
    Dec 16, 2004
  3. graphicsxp

    Session expired too early

    graphicsxp, Jul 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    498
    graphicsxp
    Jul 4, 2006
  4. D_W
    Replies:
    15
    Views:
    959
    Neredbojias
    Jul 28, 2007
  5. Bryan Ax
    Replies:
    2
    Views:
    948
    Bryan Ax
    May 12, 2004
Loading...

Share This Page