English 中文(简体)
。 NET:如何显示舱面作为格式的超文本?
原标题:.NET: How to display string as a formatted HTML?
  • 时间:2010-05-27 13:35:44
  •  标签:
  • .net
  • asp.net

在我的行文中,我有一份超文本标记作为示意图。 如何将其转换成格式的超文本标记? 我尝试了服务器HtmlEncode(),HttpUtility.HtmlEncode(),但没有成功

最佳回答

是否像你后来做的那样:。 编码和显示 HTML - DotNetSlackers

问题回答

就像你试图通过伙伴关系将超文本内容投入一页。 NET。 如果情况并非如此,那么我道歉。

您可能希望加入一个ASP.NET。 许可证控制,而不是设置标签。 如果您需要银的超文本贴上标签,就把银的标签放在服务器上,然后填上字面。

<!-- Put into your page where you want it all to happen. -->

<asp:Literal id="labelLiteral" runat="server"/>

...

/* Put into your server code. */

// This would be where your DB content comes from.
String content = "<strong>Some Label:</strong>";

// Wrap the content in a label. Obviously you ll want better format.
String output = String.Format("<label>{0}</label>", content);

// Push the output into the literal.
labelLiteral.Text = output;

我希望这一帮助。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签