Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/325.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.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
C# 如何将纯文本转换为html并将其分配给<;李>;在c中#_C#_Asp.net_Webforms_Bulletedlist - Fatal编程技术网

C# 如何将纯文本转换为html并将其分配给<;李>;在c中#

C# 如何将纯文本转换为html并将其分配给<;李>;在c中#,c#,asp.net,webforms,bulletedlist,C#,Asp.net,Webforms,Bulletedlist,我有一个包含html内容的字符串,如下所示: string eg = "hi..how <b>are</b> you?" lst.Text = eg; 目的是以粗体显示“是”。但当前它按原样显示字符串。项目符号列表的哪个属性用于呈现字符串中的html控件? 非常感谢您的帮助。您需要使用中继器,而不是项目符号列表作为项目符号列表 不支持其列表项的HTML 类似的问题可以帮助你 这是channel9 msdn页面 从上面引用 尝试使用中继器。遗憾的是,Bullete

我有一个包含html内容的字符串,如下所示:

string eg = "hi..how <b>are</b> you?"
lst.Text = eg;
目的是以粗体显示“是”。但当前它按原样显示字符串。项目符号列表的哪个属性用于呈现字符串中的html控件? 非常感谢您的帮助。

您需要使用中继器,而不是项目符号列表作为项目符号列表
不支持其列表项的HTML

类似的问题可以帮助你

这是channel9 msdn页面

从上面引用

尝试使用中继器。遗憾的是,BulletedList不支持 它的列表项的HTML

加价

<asp:Repeater ID="Repeater1" runat="server">
    <HeaderTemplate><ul></HeaderTemplate>
    <ItemTemplate><li><span class="label">Test</span> <%# Container.DataItem %></li></ItemTemplate>
    <FooterTemplate></ul></FooterTemplate>
</asp:Repeater>

您在Web服务器上使用什么?什么是
lst
?这是ASP.NET webforms吗?MVC?我假设是webforms,但这里没有真正的上下文。@EliGassert我猜@Romoku不太可能-尝试设置会抛出NotSupportedException的值。从文档:
文本属性根据BulletedList控件中选定的列表项进行内部设置。如果直接设置Text属性,将引发NotSupportedException异常。
Hi…这是项目符号列表中的ListItem。我正在设置ListItem的Text属性。我正在使用asp.NET webforms
Repeater1.DataSource = items;
Repeater1.DataBind();