Dynamically showing radio buttons

Discussion in 'ASP .Net Web Controls' started by Gwenna Males via .NET 247, May 21, 2005.

  1. I'm have a site that shows text boxes dynamically depending on anumber that's entered in another text box - (i.e. if the personenters the number 2, they would get..)

    age.textbox, tripcost.textbox, age.textbox, tripcost.textbox.
    I'm trying to get a radio button to also appear dynamically (i.e.if the person enters the number 2, they would get..)

    age.textbox, tripcost.textbox, member.radiobutton, age.textbox,tripcost.textbox member.radiobutton

    The elements have all been named (radio buttons are member1through member10)

    The script I have is working perfectly for the age and thetripcost but I'm not very good at scripts yet and the radiobutton script isn't working. (I know that it's just because Idon't know the correct format but I can't figure it out).. thescript I have is this:

    {
    dlResidence.Value =
    pol.Pol.Residence;

    dlDestination.Value =
    pol.Pol.Destination;

    rbCoverageSingle.Checked =
    !pol.Pol.IsFamily;
    rbCoverageFamily.Checked =
    pol.Pol.IsFamily;

    txtNumAdults.Value = pol.Insureds.Count.ToString();
    hdnSelectedPlan.Value = pol.Pol.PlanCode;

    for(int i=0;i<pol.Insureds.Count;i++)
    {
    TextBox txt = FindControl("txtAdultAge"+(i+1).ToString()) asTextBox;
    txt.Visible = true;
    txt.Text = pol.Insureds.Age.ToString();

    txt = FindControl("txtTripCost"+(i+1).ToString()) as TextBox;
    txt.Visible = true;
    txt.Text = pol.Insureds.TripCost.ToString("n");

    Radiobutton rb = e.Item.FindControl("rbMember"+(i+1)) asRadioButton;
    rb.Visible = true;
    rb.Text = pol.Insureds.Member.ToString();

    }


    };

    --------------------------------
    From: Gwenna Males

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>o9yjDLTsokuGCXsXPmSDWA==</Id>
    Gwenna Males via .NET 247, May 21, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray Booysen
    Replies:
    2
    Views:
    633
    Ray Booysen
    Mar 28, 2006
  2. Scott D Johnson
    Replies:
    1
    Views:
    1,049
    Scott D Johnson
    Sep 27, 2006
  3. Replies:
    0
    Views:
    290
  4. Dr. Leff
    Replies:
    3
    Views:
    281
    David Mark
    Oct 15, 2007
  5. Dr. Leff
    Replies:
    3
    Views:
    212
    David Mark
    Oct 15, 2007
Loading...

Share This Page