GridView--列长度控制
1.在DataGrid中可以在下面解决
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
// e.Item.Cells[0].Attributes.Add("style","");
e.Item.Cells[0].Attributes.Add("style","width:100px;word-wrap : break-word ;word-break : normal ;");
}
在GridView中修改:
Item-->Row
protected void GV_RowDataBound(object sender, GridViewRowEventArgs e)
{
//e.Row.Cells[0].Attributes.Add("style", "width:100px;word-wrap : break-word ;word-break : normal ;");
//e.row.cells[i].width=100
}
如果是动态的就不太好办?虽然用循环可以控制
但列的内容无法控制
2.去掉个线
通常我们在做新闻连接的时候,不用格线.其实很简单 gv 里面加一句:
GridLines="None"
---小技巧 呵呵
本文介绍了如何在GridView中控制列的长度及文字换行,并提供了一种动态调整的方法。此外,还分享了设置GridView格线为None的小技巧。
4816

被折叠的 条评论
为什么被折叠?



