Asp.net 如何用我在泛型中编写的html代码编写字符串
我有这个字符串:Asp.net 如何用我在泛型中编写的html代码编写字符串,asp.net,Asp.net,我有这个字符串: string foo = "<p>temp</p>"; string foo=“temp”; 我如何在我的页面上显示它 不使用Response.Write(foo)一个选项是将此值指定给.aspx上控件的Text属性: // in .aspx page: <asp:literal runat="server" id="myText" /> //In the codebehind: string foo = "<p>temp&
string foo = "<p>temp</p>";
string foo=“temp”;
我如何在我的页面上显示它
不使用Response.Write(foo)一个选项是将此值指定给
.aspx
上控件的Text
属性:
// in .aspx page:
<asp:literal runat="server" id="myText" />
//In the codebehind:
string foo = "<p>temp</p>";
myText.Text = foo;
//在.aspx页面中:
//在代码隐藏中:
字符串foo=“temp”;
Text=foo;
使用文本控件,在页面上放置文本控件,然后设置
literal1.Text = foo;
您想在哪里显示它?页面上是否已经存在应添加到其中的控件,或者是否需要在页面上的某个位置添加容器控件以显示消息?