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

Building Radio Button Back End

1 Answer 58 Views
Button
This is a migrated thread and some comments may be shown as answers.
Developers
Top achievements
Rank 1
Developers asked on 23 Dec 2016, 03:19 PM

Hello!

I was wondering if there was a way on the back end to setup the toggle states like:

                <ToggleStates>
                    <telerik:RadButtonToggleState Text="Checked" PrimaryIconCssClass="rbToggleRadioChecked"></telerik:RadButtonToggleState>
                    <telerik:RadButtonToggleState Text="UnChecked" PrimaryIconCssClass="rbToggleRadio"></telerik:RadButtonToggleState>
                </ToggleStates>

 

My current code is something like this:

 RadButton button = new RadButton();
                        button.GroupName = rbl.ID;
                        button.ToggleType = ButtonToggleType.Radio;
                        button.ButtonType = RadButtonType.StandardButton;
                        button.AutoPostBack = false;
                        button.Text = row.option_name;
                        button.Value = row.option_value;
                        button.RenderMode = RenderMode.Lightweight;
                        button.Icon.PrimaryIconCssClass = "rbToggleRadio";

Would I have to set an on change to handle changing the PrimaryIconCssClass?

1 Answer, 1 is accepted

Sort by
0
Accepted
Ianko
Telerik team
answered on 27 Dec 2016, 08:32 AM

Hello Joe,

Yes, you can, by adding RadButtonToggleState instances to the ToggleStates collection of RadButton: 

...
button.ToggleStates.Add(new RadButtonToggleState("Checked") { PrimaryIconCssClass = "rbToggleRadioChecked" });
button.ToggleStates.Add(new RadButtonToggleState("UnChecked") { PrimaryIconCssClass = "rbToggleRadio" });
...

Regards,
Ianko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Button
Asked by
Developers
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or