ASP.NET control to render a

后端 未结 4 2091
Happy的楠姐
Happy的楠姐 2021-02-11 14:09

The Label control in ASP.NET seems to render tags, but is there a server control to render HTML within a

?

Sure, I coul

相关标签:
4条回答
  • 2021-02-11 14:44

    I think you need HtmlGenericControl class. It has a constructor which accepts a string variable which initializes a new instance of the HtmlGenericControl class with the specified tag:

    var div = new HtmlGenericControl("div");
    

    It is also has InnerHtml and InnerText properties (you mentioned this in a comment to the previous answer).

    0 讨论(0)
  • 2021-02-11 14:45

    Try the Panel control.

    0 讨论(0)
  • 2021-02-11 15:00

    Try this:

    <div class="myclass">
    <asp:Literal ID="mytext" runat="server"></asp:Literal>
    </div>
    

    Set your text inside Literal, which renders without html tag

    0 讨论(0)
  • 2021-02-11 15:01

    Of course: ASP.NET has a built-in control called Panel!

    And you may use it as follows:

    <asp:Panel ID="myPanel" runat="server">
        <!-- Other markup here like client and server controls/elements -->
    </asp:Panel>
    
    0 讨论(0)
提交回复
热议问题