G
Gwenna Males via .NET 247
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();
}
};
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();
}
};