首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

GridView里的每行文字太多怎么自动隐藏超出的部分

2012-01-18 
GridView里的每行文字太多如何自动隐藏超出的部分有没有哪个属性可以设置?现在会自动换行,把格子拉长,影响

GridView里的每行文字太多如何自动隐藏超出的部分
有没有哪个属性可以设置?现在会自动换行,把格子拉长,影响页面布局

[解决办法]
据说用CSS可以搞定,但不知道怎么搞
那就还是用程序解决吧,如:
<%# Eval( "邦定字段 ").ToString().Length > 10 ? Eval( "邦定字段 ").ToString().Substring(0,20) : Eval( "邦定字段 ") %>
[解决办法]
没有,只有SUBSTRING
[解决办法]
恩,substring()
[解决办法]
用SUBSTRING

[解决办法]
protected void GridView1_RowDataBound(object sender,GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
if(e.Row.Cells[1].Text).Length> 6)
{
e.Row.Cells[1].Text = (e.Row.Cells[1].Text).Substring(0,6)+ "... ";
}
if(e.Row.Cells[0].Text).Length> 6)
{
e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0,6)+ "... ";
}
}
省略...
}

热点排行