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 =

    dlDestination.Value =

    rbCoverageSingle.Checked =
    rbCoverageFamily.Checked =

    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();


    Gwenna Males via .NET 247, May 21, 2005
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.