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

Disable button

1 Answer 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
MKM
Top achievements
Rank 1
MKM asked on 14 Aug 2012, 08:09 AM
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.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Aug 2012, 08:46 AM
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.
Tags
General Discussions
Asked by
MKM
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or