• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

使用asp.net在网格视图控件断行

用户头像
it1352
帮助1

问题说明

我想将该行分成多个子行.
例如:我有这样的行

世界,你好吗?


我需要以下输出

世界您好

I want to break the row in to multiple sub row.
For example : I have a row like this

Hello world how r u.


i need the output as below

Hello world
how r u..

正确答案

#1
如果要包装句子,则可以添加< br>无论您想打破同一个地方
在您的情况下,就像

你好,世界< br>
你怎么样.

-Amol
If you want to wrap the sentence then you can add a <br> wherever you want to break the same
In your case it will be like

Hello world <br>
how r u..

-Amol
在内容中使用<br />标记
use <br /> Tag in your content
Row1<br />Row2<br />Row3


它会显示如下所示的输出
第1行
行2
行3

顺便说一句,您可以使用ItemStyle-Wrap="true"
包装内容


It''ll show you output like below
Row1
Row2
Row3

BTW you can wrap the content by using ItemStyle-Wrap="true"

<asp:gridview   runat="server" xmlns:asp="#unknown">
<columns>
<asp:boundfield itemstyle-wrap="true" datafield="Column1" />
</columns>
</asp:gridview>
选项1:为该列设置适当"的宽度,并将wrap属性设置为true.这两个属性都可以在GridViewItemStyle中找到.

选项2:在RowDataBound事件中,检查该列,然后更改文本以在所需的单词数之后添加\n.请记住将列的wrap属性设置为true.

希望这会有所帮助!
Option 1: Set "appropriate" width for that column and set the wrap property to true. Both the properties can be found in ItemStyle of the GridView.

Option 2: In the RowDataBound event, check for that column, and change the text to add \n after the number of words you want. Do remember to set the wrap property of the column to true.

Hope this helps!

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcgkeek
系列文章
更多 icon
同类精品
更多 icon
继续加载