Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi
I have a Training Html table.Some textbox and one add button in this table . When i click Add Traning(If Requird) button then Another Html table create with same data.How can i solve this problem in csharp.pls help me.
<table class="TableWorkArea" border="1px" cellpadding="3" style="border-collapse: collapse">
                            <tr>
                                <td class="TableHeading" colspan="4">
                                    SECTION G : PROFESSIONAL TRAINING</td>
                            </tr>
                            <tr>
                                <td class="TDLeftLabel" width="18%">
                                    Training On
                                </td>
                                <td class="TDRightInput" width="32%">
                                    <asp:TextBox runat="server" ID="txtTrainingOn"
                                           CssClass="TextBoxFixed" TabIndex="14" Width="196px"></asp:TextBox>
                                </td>
                             </tr>
                                <tr>
                                <td class="TDLeftLabel" width="18%">
                                  Training Duration
                                </td>
                                <td class="TDRightInput" width="32%">
                                   <asp:TextBox runat="server" ID="txtTrainingDuration"  CssClass="TextBoxFixed" TabIndex="14" Width="196px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="TDLeftLabel" width="18%">
                                    Other Info [If Any]
                                </td>
                                <td class="TDRightInput" colspan="3">
                                    <asp:TextBox runat="server" ID="txtTraningOther" CssClass="TextBoxFixed"  Width="196px"></asp:TextBox>
 
                                </td>
                            </tr>
 
                            <tr>
                                <td class="TDLeftLabel" colspan="4"><asp:Button ID="btnTraningAdd" runat="server" Text="Add Traning(If Requird)" /></td>
 
                            </tr>
                             </table>
Posted 13-Jan-13 17:20pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can use Dynamic Controls for this ::
 

 protected void btnTraningAdd_Click(object sender, EventArgs e)
    {
        HtmlTable ht = new HtmlTable();
        HtmlTableRow tr = new HtmlTableRow();
        HtmlTableCell tc = new HtmlTableCell();
        tc.InnerText = "hello";
        ht.Rows.Add(tr);
 
        tr.Cells.Add(tc);
        PlaceHolder1.Controls.Add(ht);
    }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CHill60 360
1 OriginalGriff 343
2 Sarvesh Kumar Gupta 168
3 RyanDev 145
4 Sergey Alexandrovich Kryukov 128


Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid