Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 如何用我在泛型中编写的html代码编写字符串_Asp.net - Fatal编程技术网

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;

您想在哪里显示它?页面上是否已经存在应添加到其中的控件,或者是否需要在页面上的某个位置添加容器控件以显示消息?