ASP.NET C# in Tabellen Rows hinzufügen



  • protected void Button111_Click(object sender, EventArgs e)
        {
            TableRow row = new TableRow();
            row.BorderColor = System.Drawing.Color.Black;
            row.BorderWidth = 2;
            TableCell cell = new TableCell();
            cell.Text = "gugu";
            row.Cells.Add(cell);
            int i = 5;
            for (; i >= 0; i--)
            {
                this.Table_album_control.Rows.Add(row);
            }
        }
    

    ich habe das problem das da nicht 5 rows hinzugefügt werden sondern nur 1 row. Warum??



  • Weil es immer dieselbe ist.

    int i = 5;
    for (; i >= 0; i--)
    {
        TableRow row = new TableRow();
        row.BorderColor = System.Drawing.Color.Black;
        row.BorderWidth = 2;
        TableCell cell = new TableCell();
        cell.Text = "gugu";
        row.Cells.Add(cell);
        this.Table_album_control.Rows.Add(row);
    }
    

Anmelden zum Antworten