创建服务器控件(表格)
2008-05-19 17:51
225 查看
protected void Page_Load(object sender, EventArgs e)
{
HtmlTable tb1 = new HtmlTable();
HtmlTableRow row;
HtmlTableCell cell;
tb1.Border = 1;
tb1.CellPadding = 3;
tb1.CellSpacing = 3;
tb1.BorderColor = "BLUE";
//创建行
for (int i = 1; i <= 5; i++)
{
row = new HtmlTableRow();
row.BgColor = (i % 2 == 0 ? "red" : "lightcyan");
//创建数据单元
for (int j = 1; j <= 4; j++)
{
cell = new HtmlTableCell();
cell.InnerHtml = "Row:" + i.ToString();
row.Cells.Add(cell);
}
tb1.Rows.Add(row);
}
//把表添加到页面的Controls集合中
Page.Controls.Add(tb1);
}
{
HtmlTable tb1 = new HtmlTable();
HtmlTableRow row;
HtmlTableCell cell;
tb1.Border = 1;
tb1.CellPadding = 3;
tb1.CellSpacing = 3;
tb1.BorderColor = "BLUE";
//创建行
for (int i = 1; i <= 5; i++)
{
row = new HtmlTableRow();
row.BgColor = (i % 2 == 0 ? "red" : "lightcyan");
//创建数据单元
for (int j = 1; j <= 4; j++)
{
cell = new HtmlTableCell();
cell.InnerHtml = "Row:" + i.ToString();
row.Cells.Add(cell);
}
tb1.Rows.Add(row);
}
//把表添加到页面的Controls集合中
Page.Controls.Add(tb1);
}
相关文章推荐
- 动态创建页面(服务器控件和表格)
- 动态创建页面(服务器控件和表格)
- 创建服务器控件
- 动态创建 Web 服务器控件模板
- 服务器控件单选,多选和表格样式冲突,多边框
- (CEGUI)如何创建控件 ------下拉列表框,表格框,LISTBOX
- (转)TableRow 控件与 TableCell 控件和 Table 控件一起使用,来创建表格中的行
- 动态创建 ASP.NET Web 服务器控件模板(出自MSDN)
- 创建服务器控件时INamingContainer的作用
- 创建和编辑Word、EXCEL的表格控件NetAdvantage for jQuery
- ASP.NET2.0服务器控件之创建复杂属性-.Net编程教程
- 【转】ASP.NET中服务器控件Table动态生成表格及其属性介绍
- 使用 ASP.NET 语法创建 Web 服务器控件模板
- 动态创建服务器控件,获取HTML输出(用于生成静态文件,简化页面,简化编程等)
- 可以创建专业的客户端/服务器视频会议应用程序的音频和视频控件LEADTOOLS Video Conferencing SDK
- MFC ActiveX 控件:创建自动化服务器以及出现灾难性故障原因
- ASP.NET2.0服务器控件之创建复杂属性
- [学习]创建服务器控件
- 如何:在 DataList Web 服务器控件中动态创建模板
- 动态创建服务器控件,获取HTML输出(用于生成静态文件,简化页面,简化编程等)