Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Adding dynamic controls in html table after certain <tr>

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 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