您的位置:首页 > 其它

想Table服务器控件动态添加数据

2008-04-25 15:18 495 查看
<asp:Table runat="server" ID="Table1">
<asp:TableRow>
<asp:TableCell Text="姓名">

</asp:TableCell>
<asp:TableCell Text="专业">

</asp:TableCell>
<asp:TableCell Text="毕业院校">

</asp:TableCell>
<asp:TableCell Text="个人网站">

</asp:TableCell>
</asp:TableRow>
</asp:Table>

private void AddRow(string StrName,string StrSkill,string StrSchool,string StrNet)
{
TableRow row = new TableRow();
TableCell cell1 = new TableCell();
cell1.Font.Size = FontUnit.Medium;
cell1.Text =StrName;
cell1.ForeColor = System.Drawing.Color.Red;
cell1.Width = 50;
row.Cells.Add(cell1);
TableCell cell2 = new TableCell();
cell2.Font.Size = FontUnit.Medium;
cell2.Text = StrSkill;
cell2.ForeColor = System.Drawing.Color.Red;
cell2.Width = 50;
row.Cells.Add(cell2);
TableCell cell3 = new TableCell();
cell3.Font.Size = FontUnit.Medium;
cell3.Text = StrName;
cell3.ForeColor = System.Drawing.Color.Red;
cell3.Width = 50;
row.Cells.Add(cell3);
TableCell cell4 = new TableCell();
cell4.Font.Size = FontUnit.Medium;
cell4.Text = StrNet;
cell4.ForeColor = System.Drawing.Color.Red;
cell4.Width = 50;
row.Cells.Add(cell4);
this.Table1.Rows.Add(row);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: