Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...