日期:2014-05-18  浏览次数:20521 次

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)+ "... ";
}
}
省略...
}