Eduardo Lorenzo Posted July 25, 2007 Posted July 25, 2007 Hi everyone, This has got me stumped. What I am trying to do is search for a "Clicked" HtmlInputRadioButton inside a tabcontrol. I have no idea what the ID is, or which tab the radioButton will be in. So the flow will be to go through all the controls in the each tab, check if it is an HtmlInputRadioButton, check if it is "checked" and return the Value. This is what I have at the moment and it can find the radio button(when I debug it) but doesnt return the value because it continues on to the next controls. public static string FindControlRecursively(Control controlName) { foreach (Control Ctl in controlName.Controls) { if (Ctl is HtmlInputRadioButton) { HtmlInputRadioButton testRB = ((HtmlInputRadioButton)(Ctl)); if (testRB.Checked) { return testRB.Value; } } return FindControlRecursively(Ctl); } } It doesn't seem to want to exit this function until all controls have been read. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.