FormView Insert and Validators

Discussion in 'ASP.NET / ASP.NET Core' started by bgoodbody, Oct 17, 2012.

  1. bgoodbody

    bgoodbody Bill G

    We are using Windows 2012, IIS 8 and ASP.NET 4.5

    The Edit Mode works correctly.

    When we Click a button to switch to the Insert Mode. The form displays with empty fields.

    When we Click on "Add..." button the Validators work, because if there are no mistakes, the Insert Occurs, but if there are, the form redisplays, but no Validation Summary.

    Resubmit the form (same data).. There the are..

    Any ideas? Thanks
     
  2. Im not sure I totally understand your question. If you can elaborate and clarify, we may be better able to help. Having said that, have you set Display="Dynamic" in the validator?
     
  3. bgoodbody

    bgoodbody Bill G

    To Your Question Yes.

    Page Starts in ItemTemplate (read only Mode)

    Click on button which switches to Insert Mode (InsertTemplate)

    Form Displays Fields for Entry which are blank.

    Enter some data in a field click which is edited click Add button

    Page rediplays after postback, but data is gone, no Validation Summary

    but from now on work fine.

    click on Add botton form redispalys with Validation Summary showing.

    On the first pass if one enters all the corrrect required data, it gets inserted....

    What is clear is that the Validators always fire as if the data is incorrect the form redisplays and if correct it posts.

    Sample VAlidator:
    Code:
    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="Last_NameTextBox" ValidationGroup="NewMember"
    Display="Dynamic" ErrorMessage="Please enter the Last Name." SetFocusOnError="True"
    ForeColor="Red">* </asp:RequiredFieldValidator>
     
  4. bgoodbody

    bgoodbody Bill G

    No help here?
     

Share This Page