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

Change Radbutton cssclass clientside

1 Answer 281 Views
Button
This is a migrated thread and some comments may be shown as answers.
Wired_Nerve
Top achievements
Rank 2
Wired_Nerve asked on 20 Mar 2014, 05:40 PM
When using the radbutton (see markup below) I would like to know the controls method to change the cssclass...

I figured I would have access to a method like .set_cssClass... but I don't see that... Via the documentation.. 

What is provided is the get_cssClass...   


Anyway, I know how to do this via straight javascript or jquery.. but is there a telerik way?


<telerik:RadButton ID="ImageButtonStatusLock" CssClass="UnLockIcon" runat="server" Text="Image Button" OnClientClicked="OnClientClicked" AutoPostBack="false" ButtonType="StandardButton">
         <Image EnableImageButton="true" />
     </telerik:RadButton>

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Mar 2014, 04:34 AM
Hi Warren,

You can try to set the CSS class for RadButton from client side using set_cssClass, set_disabledCssClass, set_hoveredCssClass, set_pressedCssClass and  addCssClass. Please take a look into the sample code snippet which works fine at my end.

JavaScript:
function OnClientClicked(sender, args) {
    sender.addCssClass("changeborder");
}

CSS:
.changeborder
{
    border: 1px solid red !important;
}

Thanks,
Shinu.
Tags
Button
Asked by
Wired_Nerve
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or