后台拼table 显示在前台

zhangconfident521 2010-12-16 11:25:50
就是想在asp.cs里拼一个table 显示在aspx页面
...全文
129 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
笨熊熊 2010-12-16
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wan_an 的回复:]
StringBuilder sb = new StringBuilder();
sb.Append("<table>");
sb.Append("<tr>");
sb.Append("<td>test");
sb.Append("</td>");
sb.Append("</tr>");
sb.Append("</table>");

div1.innerht……
[/Quote]
++
andrewsway 2010-12-16
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 zhangconfident521 的回复:]

好像要写一个方法
然后定义
table+=...
我就想在后台写个table 前台<%=table%>连接
[/Quote]

+=的性能差,用StringBuilder
zhangconfident521 2010-12-16
  • 打赏
  • 举报
回复
还是有点不明白 本人太笨!!
ycproc 2010-12-16
  • 打赏
  • 举报
回复


这年头StringBuilder 拼接也成了问题
zhoudianzhang 2010-12-16
  • 打赏
  • 举报
回复
你可以自定义table

HtmlTable dt = new HtmlTable();
HtmlTableRow dr = new HtmlTableRow();
HtmlTableCell dc = new HtmlTableCell();
Label lb = new Label();
dc.Controls.Add(lb..Text));
dr.Cells.Add(dc);
dt.Rows.Add(dr);
zhangconfident521 2010-12-16
  • 打赏
  • 举报
回复
好像要写一个方法
然后定义
table+=...
我就想在后台写个table 前台<%=table%>连接
wuyq11 2010-12-16
  • 打赏
  • 举报
回复
Literal.Text=sb.ToString();
wan_an 2010-12-16
  • 打赏
  • 举报
回复
StringBuilder sb = new StringBuilder();
sb.Append("<table>");
sb.Append("<tr>");
sb.Append("<td>test");
sb.Append("</td>");
sb.Append("</tr>");
sb.Append("</table>");

div1.innerhtml = sb.tostring()
  • 打赏
  • 举报
回复
using System.Text;
  • 打赏
  • 举报
回复
StringBuilder sb = new StringBuilder();
sb.Append("<table>");
sb.Append("<tr>");
sb.Append("<td>");
sb.Append("</td>");
sb.Append("</tr>");
sb.Append("</table>");
蜜_Lumia 2010-12-16
  • 打赏
  • 举报
回复
那就拼呗,楼主想问啥

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧