I set togglestate of RadButton on client-side by using set_selectedToggleStateIndex() function which works fine. However, when i try to read the state in code-behind (SelectedToggleState.Text) it returns different text than i see on the screen.
Am i missing something?
Am i missing something?
3 Answers, 1 is accepted
0
Hello,
It seems that you have been following the right approach to achieve the desired behavior of RadButton.
I've created a sample code snippet as well as a video showing the implementation:
I hope that helps.
Best Regards,
Misho
Telerik
It seems that you have been following the right approach to achieve the desired behavior of RadButton.
I've created a sample code snippet as well as a video showing the implementation:
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
runat
=
"server"
></
asp:ScriptManager
>
<
telerik:RadButton
ButtonType
=
"ToggleButton"
ToggleType
=
"CustomToggle"
ID
=
"ToggleButton1"
runat
=
"server"
>
<
ToggleStates
>
<
telerik:RadButtonToggleState
Text
=
"RadButton Toggle State 0"
Selected
=
"true"
/>
<
telerik:RadButtonToggleState
Text
=
"RadButton Toggle State 1"
/>
</
ToggleStates
>
</
telerik:RadButton
>
<
br
/>
<
input
type
=
"button"
id
=
"InputButton1"
value
=
"set_selectedToggleStateIndex(0)"
onclick
=
"InputButtonClicked(0)"
/>
<
input
type
=
"button"
id
=
"InputButton2"
value
=
"set_selectedToggleStateIndex(1)"
onclick
=
"InputButtonClicked(1)"
/>
<
br
/>
<
asp:Button
runat
=
"server"
ID
=
"PostbackButton1"
OnClick
=
"PostbackButton1Clicked"
Text
=
"Get SelectedToggleState on the server"
/>
<
script
type
=
"text/javascript"
>
function InputButtonClicked(newIndex) {
//alert(newIndex);
$find("ToggleButton1").set_selectedToggleStateIndex(newIndex);
}
</
script
>
<
script
runat
=
"server"
>
protected void PostbackButton1Clicked(object sender, EventArgs e)
{
Response.Write(ToggleButton1.SelectedToggleState.Text);
}
</
script
>
</
form
>
I hope that helps.
Best Regards,
Misho
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.
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 24 Dec 2014, 02:47 PM
This is not exactly what i was looking for, but i'll try to apply it to my needs. Thank you
0
Hi,
I hope the provided information will help you to configure RadButton in accordance with your custom scenario.
If you have further questions, please don’t hesitate to contact us.
Regards,
Misho
Telerik
I hope the provided information will help you to configure RadButton in accordance with your custom scenario.
If you have further questions, please don’t hesitate to contact us.
Regards,
Misho
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.