开发者

Inserting DropDownList in a TableCell

while (reader.Read())
{
    TableRow r = new TableRow();
    TableCell c = new TableCe开发者_运维技巧ll();

    c.Controls.Add(new LiteralControl(reader["Name"].ToString()));
    r.Cells.Add(c);
    Table1.Rows.Add(r);

    TableCell c1 = new TableCell();

    c1.Controls.Add(new LiteralControl(reader["RollID"].ToString()));
    r.Cells.Add(c1);
    Table1.Rows.Add(r);

}

i want to add another cell with a dropdownlist for every row.Could any one sort me out with this issue?


You can do like...

DropDownList ddl = new DropDownList();
ddl.ID = "ddl";
ddl.Items.Add(new ListItem("Text", "Value")); // add list items
TableCell c2 = new TableCell();
c2.Controls.Add(ddl);
r.Cells.Add(c2);
Table1.Rows.Add(r);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜