Hi, I am dealing with AJAX UpdataPanel. I created 2 radio button during run time. By default there is a button in the updatepanel.
A user will check either one radiobutton in updatepanel and then hit the button.

How do i got to know which radiobutton is checked?

RadioButton rb1 = new RadioButton();
        RadioButton rb2 = new RadioButton();
        rb1.ID = "rb1";
        rb2.ID = "rb2";
        rb1.GroupName = "group1";
        rb2.GroupName = "group1";
        rb1.Text = "Yes";
        rb2.Text = "No";
9 Years
Discussion Span
Last Post by Derice

It is possible to loop through all the control and check which radiobutton is checked? The number of radiobutton and it's id is retrieved from database. Which mean, no fix amount of radiobutton and no fix id. Only one group of radiobutton will be tabulated once. Hope this will clarify the problem.


I tried to stored the id of dynamic radiobuttons into session and reference them by:

RadioButton tb = new RadioButton();
tb = (RadioButton)UpdatePanel1.ContentTemplateContainer.FindControl("rb1");
if (tb != null)
Label1.Text = tb.Text;

I found that if i create the dynamic control in page_load then i will sucessfully reference to the dynamic control but if it is not created in page_load then I couldnt reference to the radiobutton. The function of mine is to dynamically tabulate the radiobuttons into updatepanel when a question is pick in a updatepanel. Any sugguestion to solve the problem?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.