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

RadButton Click event is not firing.

1 Answer 314 Views
Button
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 18 Feb 2013, 03:54 AM
Hi,

I am using a RadButton in one of my aspx pages but on clicking the button, the click event is not firing.
Here is the Markup of my page.

<asp:Label ID="labelCard" runat="server" Text="Select Card Type"></asp:Label>
<asp:DropDownList ID="ddlType" runat="server" AutoPostBack="true" DataTextField='<%# Eval("Type") %>' Width="120px">
    <asp:ListItem>--Select--</asp:ListItem>
    <asp:ListItem>Type 1</asp:ListItem>  
    <asp:ListItem>Type 2</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredCardValidator1" runat="server" ErrorMessage="Please select card type" ControlToValidate="ddlType" InitialValue="--Select--" />
<asp:Label ID="labelCode" runat="server" Text="Enter Coupon Code"></asp:Label>
<asp:TextBox ID="textCode" runat="server" />
<asp:RequiredFieldValidator ID="RequiredNameValidator2" runat="server" ErrorMessage="Please enter coupon code" ControlToValidate="textCode" Display="Dynamic" />
<telerik:RadButton ID="btnCheck" runat="server" Text="Submit" OnClick="btnCheck_Click">
</telerik:RadButton>

Thanks,
Ben

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 18 Feb 2013, 04:36 AM
Hi,

Most probably the button postback is not happening because of a validation control on the page, containing the RadButton. There are certain cases in which the validation requirements are not met and the RadButton doesn’t initiate postback, which may cause confusion if the validation is not easy to spot and the button is not supposed to be part of it.

If you want to exclude the RadButton from the validation mechanism of the page, you can set its CausesValidation property to false (this is also valid for a regular asp Button control).

ASPX:

<telerik:RadButton ID="btnCheck" runat="server" Text="Submit" CausesValidation="false" OnClick="btnCheck_Click">
</telerik:RadButton>

Thanks,
Princy,

Allen
Top achievements
Rank 2
Veteran
commented on 24 Sep 2021, 02:28 PM

Assuming that my problem with a RadButton is due to this, is there any way to force the validator that is causing the issue to be more visible / raise an alert or whatever?  If it is in fact failing validation, it would be nice to know when and why....
Vessy
Telerik team
commented on 29 Sep 2021, 09:19 AM

Hi Allen,

The faced issue s usually caused by the Unobtrusive validation of .NET 4.5. Although it cannot be made more visible (in terms of error messages), you can disable it by adding the following lines in the web.config:

    <appSettings>
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>

 

Tags
Button
Asked by
Ben
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or