Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

can anyone help me how to add listitem to radiobutton progmatically. my situation is when user select one of the value from dropdown list then a radiobutton will be visible.the item in radiobutton is depend on what user select from dropdownlist before.is it possible?


thanx.
Posted

 
Share this answer
 
Comments
Wonde Tadesse 11-Dec-11 21:35pm    
5+
Monjurul Habib 11-Dec-11 21:36pm    
thank you
musiw 11-Dec-11 21:42pm    
thanx habib! :D

but i have another question...when i click a radiobuttonlist i want to make panel of form visible.but it doesnt appear.

protected void Button1_Click1(object sender, EventArgs e)
{
if (ddl1.SelectedIndex == 1)
{
RadioButtonList1.Visible = true;
ListItem item;
item = new ListItem("KVDT & RIDT", "1");
RadioButtonList1.Items.Add(item);
item = new ListItem("Outside DT", "2");
RadioButtonList1.Items.Add(item);
}
if (ddl1.SelectedIndex == 2)
{
RadioButtonList1.Visible = true;
ListItem item;
item = new ListItem("ETS/EMU", "1");
RadioButtonList1.Items.Add(item);
item = new ListItem("Locomotive", "2");
RadioButtonList1.Items.Add(item);
}

}

protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 1)
{
Label4.Text = "Reactionary Delay";
Panel1.Visible = true;
}
if (RadioButtonList1.SelectedIndex == 2)
{
Label4.Text = "Cause";
Panel1.Visible = true;
}
}

is it possible radiobutton to handle event?can u help me

thanx
Monjurul Habib 11-Dec-11 21:52pm    
yes you can even without page refresh. have a look on following links(fist link is solution) and try to understand.
http://forums.asp.net/post/3638141.aspx
http://forums.asp.net/t/1517886.aspx/1
Monjurul Habib 11-Dec-11 21:54pm    
Please vote if it is helpful :)
See this link Asp.NET forum.Radiobutton Programmatically[^]
 
Share this answer
 
Comments
Monjurul Habib 11-Dec-11 21:33pm    
nice link 5!
Wonde Tadesse 11-Dec-11 21:35pm    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900