In my ASP.Net project; I'm using C# as behind code.
One of my project functions creates some text boxes dynamically, according to user's needs. Each textbox has a different Id.
My question is开发者_如何学运维 how can I access those textboxes by Id?
Let say that were created 5 textboxes, how can I edit the code of specifically one of them?
Bellow is the actual code that I use to generate those textboxes:
int name_id = 1;
foreach (WebApplication5.ServiceReference1.ClientData client in Clients)
{
    TextBox1 = new TextBox();
    TextBox1.ID = name_id.ToString();
    TextBox1.Style["Position"] = "Absolute";
    TextBox1.Style["Top"] = y + "px";
    TextBox1.Style["Left"] = x + "px";
    TextBox1.Text = client.descricao;
    Form.Controls.Add(TextBox1);
    name_id++;
    x = x + 10;
    y = y + 10;
}
You can do this in code behind;
TextBox tb1 = (TextBox)FindControl(name_id)
TextBox tb = Form.FindControl(TextBox1.ID) as TextBox
Only like this, the reson why you can't access by ID directly is they absent at *.designer.cs.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论