Solved

Adding dynamic controls in html table after certain <tr>

Posted on 2013-05-18
1
400 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now