文字很长然后显示为...... [英] Text is long then display as ......
本文介绍了文字很长然后显示为......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网格视图中显示数据。
但是有些数据比为该列指定的空间要长。
如果数据很长则表示为.....
我该怎么办?
I display data in grid view.
but some data is longer then space specified for that column.
if data is long then it represent as .....
what can i do for that?
推荐答案
只需将属性添加到GridView中的特定列,并设置样式word-break:break-all; word-wrap:break-word
在GridView的 RowCreated 事件中,我们设置了需要换行的列的宽度。
Just add an attribute to a particular column in the GridView and set the style "word-break:break-all;word-wrap:break-word
" and at RowCreated event of GridView we set the Width of the column that we need to wrap.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Attributes.Add("style", "word-break:break-all;word-wrap:break-word");
}
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
//just changed the index of columns and the value of Unit based on your requirements
this.GridView1.Columns[0].ItemStyle.Width = new Unit(100);
}
祝你好运,
OI
Good luck,
OI
这并不困难。看看这里:多选滴使用通用抽象PopUp类的向下列表 [ ^ ]并查看 FitTextToSpace
方法
It''s not that difficult. Have a look here: A multi-selection Drop Down List using a generic Abstract PopUp class[^] and see the FitTextToSpace
method
这篇关于文字很长然后显示为......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文