Disable button

2 posts, 0 answers
  1. MKM
    MKM avatar
    2 posts
    Member since:
    Aug 2012

    Posted 14 Aug 2012 Link to this post

    Hi all,


    I have got a RadButton in which i  want to change the color after the click event. After the first button click,  the button shoud be in a disabled state, so that it wont allow the another click.

    <telerik:RadButton ID="RadButton1" runat="server"  onclick="RadButton1_Click">
    </telerik:RadButton>

    Please provide a solution as soon as possible.

    Thanks,
    Mkm.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Aug 2012 Link to this post

    Hi MKM,

    Try the following code snippet to achieve your scenario.

    CSS:
    <style type="text/css">
      .colored
       {
         background-color: Green !important;
       }
      .RadButton_Default.rbSkinnedButton, .RadButton_Default .rbDecorated, .RadButton_Default.rbVerticalButton, .RadButton_Default.rbVerticalButton .rbDecorated, .RadButton_Default .rbSplitRight, .RadButton_Default .rbSplitLeft
       {
         background-image: none !important;
       }
      .notdisabled
       {
         border: 1px solid black !important;
       }
    </style>

    ASPX:
    <telerik:RadButton ID="RadButton1" runat="server" OnClientClicked="OnClientClicked" AutoPostBack="false" DisabledButtonCssClass="colored" CssClass="notdisabled">
    </telerik:RadButton>

    JS:
    <script type="text/javascript">
        function OnClientClicked(sender, args) {
            sender.set_enabled(false);
        }
    </script>

    Hope this helps.

    Regards,
    Princy.
Back to Top