Dynamic control values

How do I get the text of a dynamic text box that is added to a dynamic table that is added to a panel in a form that form has a master page?

0


a source to share


1 answer


Presumably you are talking about ASP.NET? Are you trying to get the value in the code behind or client side using Javascript?

If its server side and yours are <asp:Panel>

declared on the page, you can do ...



foreach(Control c in myPanel.Controls)
{
    if(c.GetType() == typeof(TextBox))
    {
        TextBox tb = c as TextBox;
        if(tb.ID == "The ID Your Looking For")
        {
           //Do stuff with tb.Text;
        }
    }
}

      

0


a source







All Articles