Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RadioButtonList's SelectedIndexChange event

Status
Not open for further replies.

maboo59

Programmer
Mar 21, 2005
18
US
I have a RadioButtonList that is created in the .cs file, it only has 2 options in it that is added to a asp:table. I want to be able to show different options on the page based on which radio button they click. All are created dynamically.
ArrayList cg = new ArrayList(2);
cg.Add("Ca");cg.Add("b");
dd= new RadioButtonList();
dd.ID="dd";
dd.DataSource=cg;
dd.SelectedIndex=0;
dd.RepeatColumns=1;
dd.DataBind();
dd.AutoPostBack=true;
tr.Cells.Add(myUtils.addRadioButtonListCell(dd,""));

I tried to add a function to the radio list but it isn't getting called when the page submits:

dd.Attributes.Add("onClick", "dd_click");

I want it called in the .cs file.
Is it possible? How?
THanks
Maboo59
 
Change your code to add the attribute before adding it to the cell...
Hope this helps..
Code:
cg.Add("Ca");cg.Add("b");
dd= new RadioButtonList();
dd.ID="dd";
dd.DataSource=cg;
dd.SelectedIndex=0;
dd.RepeatColumns=1;
dd.DataBind();    
dd.AutoPostBack=true;
dd.Attributes.Add("onClick", "dd_click");
tr.Cells.Add(myUtils.addRadioButtonListCell(dd,""));



Sunil
 
sunila7,
I actually do have it that way, but moved it when i copied it.
maboo59
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top