Solved

Adding dynamic controls in html table after certain <tr>

Posted on 2013-05-18
1
402 Views
Last Modified: 2013-05-20
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,
0
Comment
Question by:tia_kamakshi
1 Comment
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 39177759
You need to use an asp.net table, check the sample on the links:
http://msdn.microsoft.com/en-us/library/7bewx260(v=vs.100).aspx
http://www.dotnetcurry.com/ShowArticle.aspx?ID=135

Note: Any particular reason for using "table" not asp.net table.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question