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>
    ErrorMessage="Debe digitar números en el campo, sin caractéres especiales ni letras." ValidationExpression="^[0-9]*$">
    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.

  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. 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!

    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"
  4. Slav
    Slav avatar
    1359 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.
    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