如何打破 BoundField 的 HeaderText [英] How do I break the a BoundField's HeaderText

查看:16
本文介绍了如何打破 BoundField 的 HeaderText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表格的 td 中的 HTML 中,您可以通过在单词之间使用 <BR> 来中断文本.这也适用于 TemplateItem 的 HeaderText 但不适用于 BoundField 的 HeaderText.如何分解 BoundField 的标题文本.

In HTML in the td of a table you can break text by using <BR> between the words. This also works in the HeaderText of a TemplateItem but not the HeaderText of a BoundField. How do I break up the Header text of a BoundField.

推荐答案

BoundField

 <asp:BoundField DataField="SomeDataField" 
        HeaderText="SomeHeader<br />(OtherData)" 
        HtmlEncode="false" />

BoundField.HtmlEncode 默认为 true,这意味着如果在文本中添加 HTML,它将被编码.
如果 HtmlEncode 设置为 false,则不会对文本进行编码,并且 br 将按预期工作.不幸的是,不能只为标题文本指定此项,它也会影响单元格内​​容.

BoundField.HtmlEncode is true by default which means that if HTML is added in the text it will be encoded.
If HtmlEncode is set to false the text is not encoded and the br will work as expected. Unfortunately is not possible to specify this only for the header text, it will affect the cell contents as well.

这篇关于如何打破 BoundField 的 HeaderText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆