某些时候,我们需要在网页显示Html真实效果,而非是html code。要实现这个功能,我们可以使用asp:Literal控件即可。

如: 

View Code

<asp:Literal ID="Literal1" runat="server"></asp:Literal>

  

在cs中写: 

View Code
protected void Page_Load(object sender, EventArgs e)
{
 string table = "<table cellspacing=\"0\" cellpadding=\"3\" border=\"1\"><tr><td style=\"border:1px;\">shuju</td></tr></table>";
      this.Literal1.Text = table;
}

 

效果:

使用asp:Literal控件显示Html代码

 

相关文章:

  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2021-11-21
猜你喜欢
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
相关资源
相似解决方案