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

How do I use Ribbonbar Togglebuttons clientside?

1 Answer 65 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
per
Top achievements
Rank 1
per asked on 21 Jun 2012, 02:40 PM
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,




1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 26 Jun 2012, 09:58 AM
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.
Tags
RibbonBar
Asked by
per
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or