Change Radbutton cssclass clientside

2 posts, 1 answers
  1. Wired_Nerve
    Wired_Nerve avatar
    163 posts
    Member since:
    Oct 2007

    Posted 20 Mar 2014 Link to this post

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

    Posted 20 Mar 2014 in reply to Wired_Nerve Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top