RequiredValidator in InlineInsertTemplate

2 posts, 0 answers
  1. Diego
    Diego  avatar
    5 posts
    Member since:
    Jan 2012

    Posted 20 Sep 2012 Link to this post

    Hello, 
    I'm creating a Custom InlineInsertTemplate and I have to add some RequiredValidator for some fields inside form as follow bellow:

    <InlineInsertTemplate>
                                        <telerik:RadTextBox runat="server" ID="txtContato" ValidationGroup="1" CssClass="text-box single-line ui-corner-all">
                                        </telerik:RadTextBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ValidationGroup="1" 
                                        ControlToValidate="txtContato" Display="Dynamic" ErrorMessage="Campo obrigatório." ForeColor="Red">
                                        </asp:RequiredFieldValidator>
    <telerik:RadButton ID="btnSave" CausesValidation="true" ValidationGroup="1" CommandName="Insert" Text="Salvar" runat="server"></telerik:RadButton>
    </InlineInsertTemplate>
     

    But when I click in my save button, the form cause an postback and not validate my form.

    How I do to solve this problem?

    Best Regards,

    Diego Oliveira

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Sep 2012 Link to this post

    Hi Diego,

    Try setting CausesValidation as false for the RadButton.
    aspx:
    <telerik:RadButton ID="btnSave" CausesValidation="false" ValidationGroup="1" CommandName="Insert" Text="Salvar" runat="server"></telerik:RadButton>

    Thanks,
    Shinu.
Back to Top