Can I copy a table to another table with an equal sign? If not, how?

How can I copy table controls?

table2=table1?

Managing an ASP.NET C Table by Visual Studio 2008.

The reason is that it works for strings. Suppose the following rows are tables.

string full; 
string userinput;
full = full + userinput;
+3
source share
1 answer

Change: . Answering this question back in June 2010, I spent a lot of time using jQuery to perform this kind of action on the client. If you are interested in this approach, take a look at jQuery clone () and append (), after (), before () and their associated methods. Edit end

, . , , . , . System.ICloneable, , .

, , , , , . , ?

, , , , ..:

    protected void CopyTable()
    {
        var clontable= new HtmlTable();
        var mytbl = form1.FindControl("mytable") as HtmlTable;
        if (mytbl != null)
        {
            HtmlTableRow myrow;
            HtmlTableCell mycell;

            for (int i = 0; i < mytbl.Rows.Count - 1; i++)
            {
                myrow = new HtmlTableRow();
                for (int j = 0; j < mytbl.Rows[i].Cells.Count - 1; j++)
                {
                    mycell = new HtmlTableCell();
                    mycell.InnerHtml = mytbl.Rows[i].Cells[j].InnerHtml;
                    myrow.Cells.Add(mycell);
                }
                clontable.Rows.Add(myrow);
            }
            form1.Controls.Add(clontable);
        }
    }
+6

Source: https://habr.com/ru/post/1751341/


All Articles