代码如下:
动态建表,怎么对name2[]中字符加入超链接?
for (int j = 0; j < count; j++)
{
HtmlTableRow r =new HtmlTableRow();
for (int i = 0; i < 4; i++)
{
HtmlTableCell c = new HtmlTableCell();
switch(i)
{
case 0:
c.InnerText="<a href="+"\"~/10.aspx\""+">"+name2[j]+"</a>";
r.Cells.Add(c) ;
break;
case 1:
c.InnerText = author2[j];
r.Cells.Add(c) ;
break;
case 2:
c.InnerText = Convert.ToString(time2[j]);
r.Cells.Add(c) ;
break;
case 3:
c.InnerText = press2[j];
r.Cells.Add(c);
break;
}
}
table1.Rows.Add(r);
table1.Border = 1;
}
------最佳解决方案--------------------------------------------------------