#1
  1. No Profile Picture
    Registered User

    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    How to make a textbox only appear when a specific radio button is selected


    Hi,
    I am new on the asp forum, My question how do I make a textbox to only appear once I've selected a radio button that only requires that information
    I am using source code on c# to design the GUI

    this is the code for the radiobutton:
    <asp:RadioButton ID="radGranular" runat="server" GroupName ="Type" Text="Granular" />
    </asp:Panel>


    this is the textbox that I want to only appear once the radio button has been selected

    <td class="auto-style10">Drying Agent(g)</td>
    <td>
    <asp:TextBox ID="txtdry" runat="server"> </asp:TextBox>
    </td>

    Thanks.
  2. #2
  3. No Profile Picture
    Registered User

    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0
    Hi,
    I finally found the solution to my problem,my program was missing some code


    <asp:RadioButton ID="radGranular" runat="server" GroupName ="Type" Text="Granular" AutoPostBack="true" />
    </asp:Panel>

    <td class="auto-style10"><asp:Label Text="Drying Agent(g)" runat="server" ID="lbldryagent" Visible="false"></asp:Label></td>
    <td>
    <asp:TextBox ID="txtdry" runat="server" Visible="false" > </asp:TextBox>
    </td>


    protected void Page_Load(object sender, EventArgs e)
    {
    if (radGranular.Checked)
    txtdry.Visible = true;
    else
    txtdry.Visible = false;

    if (radGranular.Checked)
    lbldryagent.Visible = true;
    else
    lbldryagent.Visible = false;

    }
  4. #3
  5. No Profile Picture
    Registered User

    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Smile Solution to the texbox appearing when a radio button is selected


    Hi,
    I finally found the solution to my problem,my program was missing some code


    <asp:RadioButton ID="radGranular" runat="server" GroupName ="Type" Text="Granular" AutoPostBack="true" />
    </asp:Panel>

    <td class="auto-style10"><asp:Label Text="Drying Agent(g)" runat="server" ID="lbldryagent" Visible="false"></asp:Label></td>
    <td>
    <asp:TextBox ID="txtdry" runat="server" Visible="false" > </asp:TextBox>
    </td>


    protected void Page_Load(object sender, EventArgs e)
    {
    if (radGranular.Checked)
    txtdry.Visible = true;
    else
    txtdry.Visible = false;

    if (radGranular.Checked)
    lbldryagent.Visible = true;
    else
    lbldryagent.Visible = false;

    }

Similar Threads

  1. Radio button selected value from database
    By phoenixaz in forum ASP Development
    Replies: 3
    Last Post: January 22nd, 2010, 06:23 PM
  2. Radio button not selected inside Datagrid
    By buzyonok in forum .NET Development
    Replies: 2
    Last Post: November 22nd, 2006, 01:23 PM
  3. Selected value of radio button
    By ashishdh in forum .NET Development
    Replies: 0
    Last Post: October 16th, 2006, 12:50 AM
  4. Seeing if radio button is selected
    By jalldridge in forum HTML, JavaScript And CSS Help
    Replies: 12
    Last Post: November 29th, 2005, 11:10 AM
  5. want to validate only specific textbox on button click?
    By rainbow11 in forum .NET Development
    Replies: 5
    Last Post: September 30th, 2004, 07:56 PM

IMN logo majestic logo threadwatch logo seochat tools logo