Button not bypassing validation

2 posts, 0 answers
  1. TRA
    TRA avatar
    7 posts
    Member since:
    Aug 2008

    Posted 03 Sep 2014 Link to this post

    I have a few buttons on my form that I just switched from ASP to Telerik. 

    My form does some validation that I need these buttons to bypass. 

    <form id="frmCheck" onsubmit="return Frm_onsubmit();" method="post" runat="server">

    ​ <telerik:RadButton ID="btnBatchT" runat="server" Text="Print Proof Listing" UseSubmitBehavior="false" CausesValidation="false" AutoPostBack="true" CssClass="css3Grad" Height="25px" Width="15%">
    <Icon PrimaryIconCssClass="rbPrint" PrimaryIconLeft="4" PrimaryIconTop="3"></Icon>
    </telerik:RadButton>




    I need this to call my VB function and not go through my page validations.  How can I get these buttons to go straight to VB code?

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 04 Sep 2014 Link to this post

    Hello,

    I have already replied to the support ticket that was opened by you on this regard, so that I paste my answer below:

    If you need to execute a server-side code when a RadButton is clicked you can simply handle its OnClick event. For example:
    ASPX:

    <telerik:RadButton ID="btnBatchT" runat="server" Text="Print Proof Listing" UseSubmitBehavior="false" CausesValidation="false" AutoPostBack="true" CssClass="css3Grad" Height="25px" Width="15%" OnClick="btnBatchT_Click">
        <Icon PrimaryIconCssClass="rbPrint" PrimaryIconLeft="4" PrimaryIconTop="3"></Icon>
    </telerik:RadButton>
    VB:
    Protected SubbtnBatchT_Click(sender As Object, e As EventArgs)
        Dim script As String = "function f(){alert('server-side click triggered'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Me, Me.GetType(), "key", script, True)
    End Sub

    You can also click a RadButton with JavaScript through its .click() method.



    Regards,
    Danail Vasilev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top