代码之家  ›  专栏  ›  技术社区  ›  Kimtho6

如何用我在panal中编写的html编写字符串

  •  0
  • Kimtho6  · 技术社区  · 15 年前

    string foo = "<p>temp</p>";
    

    我怎样才能在我的页面上显示出来 不使用Response.Write(foo)

    2 回复  |  直到 15 年前
        1
  •  6
  •   Oded    15 年前

    一个选项是将此值分配给 Text 财产 Literal .aspx :

    // in .aspx page:
    <asp:literal runat="server" id="myText" />
    
    //In the codebehind:
    string foo = "<p>temp</p>";
    myText.Text = foo;
    
        2
  •  1
  •   Arsen Mkrtchyan    15 年前

    使用Literal控件,在页面上放置Literal控件,然后设置

    literal1.Text = foo;
    
    推荐文章