RadButton and AjaxControlToolkit

4 posts, 0 answers
  1. Juan
    Juan avatar
    20 posts
    Member since:
    Jan 2012

    Posted 25 Jun 2012 Link to this post

    Hi i have this validation


    <asp:TextBox runat="server" ID="txbcantidad" CssClass="borde_txb" Width="45"></asp:TextBox>
    <asp:RegularExpressionValidator
    EnableClientScript="true"
    SetFocusOnError="true"
    ID="Regtxbcantidad"
    Display="None"
    ValidationGroup="valaccion_paso3_tab2"
    runat="server"
    ControlToValidate="txbcantidad"
    ErrorMessage="Debe digitar números en el campo, sin caractéres especiales ni letras." ValidationExpression="^[0-9]*$">
    </asp:RegularExpressionValidator>
    <cc1:ValidatorCallOutExtender
    CssClass="valtooltip"
    PopupPosition="TopLeft"
    WarningIconImageUrl="~/admin/img_alcalist/ico_alerta_val.gif"
    CloseImageUrl="~/admin/img_alcalist/ico_cerrar_val.gif"
    ID="Valtxbcantidad"
    runat="server"
    TargetControlID="Regtxbcantidad"
    HighlightCssClass="campofallido" />

    the textbox txbcantidad is in radgrid, this is the radbutton that activate the validation

     <telerik:RadButton ID="btnaccion2_paso3_tab2" runat="server" Skin="Office2010Blue" CssClass="txt11000" Text="Guardar Cambios" ValidationGroup="valaccion_paso3_tab2" CommandArgument="guardarref" OnCommand="realizaraccion"></telerik:RadButton>

    my problem is that even if validation is enabled in the click event, the button causes postback and gets an error.

    normal in this situation is that if the validation is enabled the button doesn't postback, how i fix this?

    note that this controls are in a file ".ascx", which is called in a page ".aspx" that have one update panel. maybe this helps.

    thanks.
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 27 Jun 2012 Link to this post

    Hello Juan,

    I'm going to ask a stupid question, but I just want to make sure I'm understanding when the validation fails.

    In your textbox, you are entering something and then clicking the button, right? As the RegularExpressionValidator only validates when something is entered in the textbox. Or does the button still postback, even though you've entered invalid data?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Juan
    Juan avatar
    20 posts
    Member since:
    Jan 2012

    Posted 29 Jun 2012 Link to this post

    Hi Kevin

    yes, the button does still postback even though you've entered invalid data. this is my problem and i don't know how to solve, help me please!

    thanks.
    Don't forget "this controls are in a file ".ascx", which is called in a page ".aspx" that have one update panel. maybe this helps"
  5. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 03 Jul 2012 Link to this post

    Hi Juan,

    Please check the online demo Grid / Flexible Server-Side Validation. It shows how to implement validation in a RadGrid edit form. Note that the property EnableValidation of the RadGrid inner property EnableValidation should be set to true in order to enable the validation. I would suggest using this demo as a reference for achieving the desired functionality.
     
    Regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top