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

Button not bypassing validation

1 Answer 91 Views
Button
This is a migrated thread and some comments may be shown as answers.
TRA
Top achievements
Rank 1
TRA asked on 03 Sep 2014, 01:40 PM
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?

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 04 Sep 2014, 07:57 AM
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.

 
Tags
Button
Asked by
TRA
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or