如何使用asp.net在运行时向表中添加任何行? [英] how to add any rows to table in runtime with asp.net?
本文介绍了如何使用asp.net在运行时向表中添加任何行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用asp.net?
how to add any rows to table(<asp:table>) in runtime with asp.net?
推荐答案
在运行时向表中添加任何行(< asp:table>),您好,请尝试以下代码:< br $> b $ b
Page.aspx
Hello friend, try this code:
Page.aspx
<asp:table id="Table1" runat="server" borderstyle="Solid" borderwidth="1" width="100px" xmlns:asp="#unknown"></asp:table>
页面.aspx.cs
Page.aspx.cs
//Create a Label control to show a message
Label lbl = new Label();
lbl.Text="Hello world";
//Create a TableRow control
TableRow tr = new TableRow();
//Create a TableCell control
TableCell tc = new TableCell();
//Add the lable to TableCell control
tc.Controls.Add(lbl);
//Add TableCell control to TableRow control
tr.Cells.Add(tc);
//Finally add the TableRow to Table control
Table1.Rows.Add(tr);
如有任何进一步询问,请通知我。
- DD
Let me know in case of any further query.
- DD
阅读解决方案1 ,然后查看此参考资料以获取更多信息。 :)
动态地向表中添加行(C#) [ ^ ]
Read solution 1 and then see this reference for more information. :)
Dynamically adding rows to the table (C#)[^]
这篇关于如何使用asp.net在运行时向表中添加任何行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文