RadButton Click event is not firing.

2 posts, 1 answers
  1. Ben
    Ben avatar
    31 posts
    Member since:
    Feb 2013

    Posted 17 Feb 2013 Link to this post

    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
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 17 Feb 2013 Link to this post

    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,

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