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

2014 Q2 - setting toggle state programmatically no longer fires ClientToggleStateChanged event

2 Answers 18 Views
Button
This is a migrated thread and some comments may be shown as answers.
Joe Sugden
Top achievements
Rank 1
Joe Sugden asked on 23 Jul 2014, 08:48 PM
var button = $find("<%= btnToggle.ClientID %>");
button.set_selectedToggleStateIndex(0);

This code used to fire the client ToggleStateChanged event, but now it no longer does - and I need it to.

I can work around by calling the event code directly for now, except I won't have the proper eventArgs parameter to pass in.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 24 Jul 2014, 05:54 AM
Hi Joe Sugden,

Please have a look into the sample code snippet which works fine at my end.

ASPX:
<telerik:RadButton ID="RadButton1" runat="server" ButtonType="LinkButton" ToggleType="CustomToggle"
    OnClientToggleStateChanged="toggleStateChanged" AutoPostBack="false">
    <ToggleStates>
        <telerik:RadButtonToggleState Text="ToggleButton: Mute"></telerik:RadButtonToggleState>
        <telerik:RadButtonToggleState Text="ToggleButton: Low"></telerik:RadButtonToggleState>
        <telerik:RadButtonToggleState Text="ToggleButton: Medium"></telerik:RadButtonToggleState>
        <telerik:RadButtonToggleState Text="ToggleButton: High"></telerik:RadButtonToggleState>
    </ToggleStates>
</telerik:RadButton>

JavaScript:
function toggleStateChanged(sender, args) {
    sender.set_selectedToggleStateIndex(2);
}

Thanks,
Shinu.
0
Dobromir
Telerik team
answered on 24 Jul 2014, 11:12 AM
Hello Joe,

Thank you for bringing this problem to our attention.

I have logged it into our database and we will do our best to have it fixed for one of the upcoming releases. You can follow the development of this bug in our feedback portal: http://feedback.telerik.com/Project/108/Feedback/Details/134398-fix-clientselectedtogglestatechanged-event-is-not-raised-when-executing-set-sele

Unfortunately, I am not able to provide suitable workaround at this point, what I can suggest you is to manually call the event handler when calling set_selectedToggleStateIndex. Please excuse us for the inconvenience.

As a small token of gratitude I have update your Telerik points.

Regards,
Dobromir
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Button
Asked by
Joe Sugden
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or