How do I use Ribbonbar Togglebuttons clientside?

2 posts, 0 answers
  1. per
    per avatar
    1 posts
    Member since:
    Aug 2010

    Posted 21 Jun 2012 Link to this post

    Hi,
    I want to be able to prevent the toggle button from posting back, while retaining the toggle state change in order to run some custom client-side code that represents the action taken by the button-click.

    I noticed that one can cancel the postback by using:
    args.set_cancel(true)
    however when this is done, the toggle event itself is completely cancelled and the state remains as-is. There doesn't seem to be any Postback="false" options on the RibbonBar items, am I missing something?

    Thanks,




  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 26 Jun 2012 Link to this post

    Hello Per,

    You can use jQuery to find the toggle button by its css class and add (or remove when you need to remove the toggle state of the button)  the respective styles by using the predefined rrbToggled css class. For instance the code below sets the rrbToggled class when a toggle button is clicked:
    function OnClientButtonToggling(sender, args) {
              args.set_cancel(true);
              $telerik.$(".rrbToggleButton").addClass("rrbToggled");
          }

    markup:
    <telerik:RadRibbonBar ID="RadRibbonBar1" runat="server" Width="100%" OnClientButtonToggling="OnClientButtonToggling"> ....

    Regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top