开发者

ASP.NET DataBoundField DataFormatString, how can I add html correctly?

I have a DataboundField in a grid. I'm trying to display a date in Euro format and the time. The time should be wrapped in a span with a css class applied to it.

I am using this, DataFormatString="{0:dd/MM/yyyy <\span cla\s\s='tinyDate'>hh:mm:ss</\span>}"

It's actually pretty close, except the span tag is literally rendering in the browser.

In the cell the text looks like this

19/10/2010 <span class=tinyDate>09:35:00</span>

I don't intend to see the span tag, only it's formatted content. How can I remedy this and make it ren开发者_JAVA技巧der correctly?

Thanks for any tips or links.

Cheers,

~ck in San Diego


Try setting the HtmlEncode property of the field to "false". It's enabled by default to prevent any malicious client-script code from being executed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜