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

Show radtextbox on selecting radiobutton option.

1 Answer 170 Views
Input
This is a migrated thread and some comments may be shown as answers.
Needha
Top achievements
Rank 1
Needha asked on 15 Apr 2013, 08:47 AM
Hi,

My first question is does telerik has a RadioButtonList control like in ASP. Now I am using asp RadioButtionList that contain few options. On Clicking the "other", i want to display a RadTextBox. Similarly selecting other buttons, i need to hide the RadTextBox. I am not good in Client side code. So please help.

Thanks in advance,
Needha.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 Apr 2013, 10:01 AM
Hi Needha,

It is possible to create a RadioButtonList using Telerik RadControls. Please check the following mark-up.

ASPX:
<span style="padding: 10px; border: 1px solid black; display: inline-block;">
    <telerik:RadButton ID="RadButton16" runat="server" ToggleType="Radio" ButtonType="ToggleButton"
        Text="Option 1" GroupName="StandardButton" AutoPostBack="false">
    </telerik:RadButton>
    <br />
    <telerik:RadButton ID="RadButton17" runat="server" ToggleType="Radio" Checked="true"
        Text="Option 2" GroupName="StandardButton" ButtonType="ToggleButton" AutoPostBack="false">
    </telerik:RadButton>
    <br />
    <telerik:RadButton ID="RadButton18" runat="server" ToggleType="Radio" GroupName="StandardButton"
        Text="Option 3" ButtonType="ToggleButton" AutoPostBack="false">
    </telerik:RadButton>
</span>

Your requirement is not possible to achieve since ASP RadioButtonList does not have sufficient client side events. Therefore set the AutoPostBack property of the RadioButtonList to true and try the below C# server-side code.

C#:
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
    if (RadioButtonList1.SelectedItem.Text == "Other")
    {
        RadTextBox1.Visible = true;
    }
    else
    {
        RadTextBox1.Visible = false;
    }
}

Thanks,
Princy.
Tags
Input
Asked by
Needha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or