This is a migrated thread and some comments may be shown as answers.

Popup FormTemplate validation causing async postback?

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jitin
Top achievements
Rank 1
Jitin asked on 04 Jun 2015, 07:51 PM

Hi all,

 I'm trying to validate some fields in a FormTemplate inside of a RadGrid and everything is working fine except for one problem. Whenever the submit button is pressed, an async postback is triggered and after postback the validators are triggered. Functionality wise it works fine, the update/insert isn't persisted, but I don't understand why the post-back is occurring (and causing the ajax loading panel to trigger) instead of the validation occurring all on the client side. Is it possible to prevent the post-back? Form is below and the page is using RadAjaxManager for async. Thanks.

<EditFormSettings EditFormType="Template" CaptionFormatString="Create/Edit Broker" PopUpSettings-Modal="True">
    <FormTemplate>
        <div class="form-template">
            <table>
                <tr>
                    <td>Name</td>
                    <td>
                        <asp:TextBox ID="tbName" runat="server" Text='<%# Bind("NAME") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="tbName" ValidationGroup="form" ErrorMessage="Required!" Display="Dynamic" CssClass="required" />
                    </td>
                </tr>
                <tr>
                    <td>Broker</td>
                    <td>
                        <icl:KeyNameDropDown runat="server" ID="ddlBroker" AppendDataBoundItems="True" />
                        <asp:RequiredFieldValidator ID="rfvBroker" runat="server" InitialValue="0" ControlToValidate="ddlBroker" ValidationGroup="form" ErrorMessage="Required!" Display="Dynamic" CssClass="required" />
                    </td>
                </tr>
                <tr>
                    <td>Is Active</td>
                    <td>
                        <asp:CheckBox ID="cbActive" runat="server" Checked='<%#  Eval("ISACTIVE").ToString().Equals("True") %>' />
                    </td>
                </tr>
            </table>
 
            <asp:LinkButton ID="btnUpdate" runat="server"
                Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' ValidationGroup="form" />
        </div>
    </FormTemplate>
</EditFormSettings>

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 09 Jun 2015, 12:40 PM
Hello Jitin,

I've created a sample RadGrid web site to test the described scenario. On my side the validation works as expected. Could you run the attached application and let me know about the result?

You can temporarily disable any AJAX in your actual project and enable your script debugger (FireBug or F12) to see whether there are any script errors interfering.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Jitin
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or