Link to home
Start Free TrialLog in
Avatar of tia_kamakshi
tia_kamakshiFlag for United Arab Emirates

asked on

Adding dynamic controls in html table after certain <tr>

Hi,

I am working on ASP.net 2.0 application using C#

I need to create dynamic control in my html table

<table width="90%" id="tblForm" runat="server">
            <tr id="dynRow" runat="server">
                <td id="dynTD" runat="server">
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>hgf
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblText" runat="server" Text="Click button for the text"></asp:Label></td>
                <td>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Text="Submit" /></td>
                <td>
                </td>
                <td>
                </td>
            </tr>
        </table>
            

Open in new window

I am able to create dynamic control as below:
      
TextBox txtBox = new TextBox();
	txtBox.ID = "txtBox1";
	txtBox.Visible = true;

	dynTD.Controls.Add(txtBox);

Open in new window

     
But the problem is I need to add more <tr> after <tr> having id "dynRow"
and then adding controls to it.

Please advise how to find <tr> from table and add further dynamic <tr> after it by adding controls.

Regards,
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial