Show radtextbox on selecting radiobutton option.

2 posts, 1 answers
  1. Needha
    Needha avatar
    14 posts
    Member since:
    Mar 2013

    Posted 15 Apr 2013 Link to this post

    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.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Apr 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top