Reputation: 183
I'm trying to dynamically add asp.net controls into HTML table, not the ASP.NET table. Well, let's just say that controls that i want to add is a textbox. How can i achieve that?
Upvotes: 1
Views: 3825
Reputation: 1708
Do one thing, use <asp:Panel>
or <asp:PlaceHolder>
in side any td in which you want to put your dynamic control. and then using their ID you can put your control in side that table.
e.g
Asp File:-
<table>
<tr>
<td><asp:PlaceHolder ID="placeHolder1" runat="server"/><td>
</tr>
</table>
Code Behind:-
TextBox t1 = new TextBox();
t1.ID="txt1";
placeHolder1.Controls.Add(t1);
Try this and let me know if this works or not.
Upvotes: 1