如何使用asp.net在网格视图控件中中断行 [英] How to break the row in grid view control using asp.net

查看:70
本文介绍了如何使用asp.net在网格视图控件中中断行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

世界,你好吗?


我需要以下输出

世界您好

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..

推荐答案

如果要包装句子,则可以添加< 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 id="GridView1" 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!


这篇关于如何使用asp.net在网格视图控件中中断行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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