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" ---小技巧 呵呵