我有以下代碼的高度:設定的行,方法的RowDataBound
protected void exampleGridView_RowDataBound(object o, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Width = new Unit("150px");
e.Row.Cells[1].Width = new Unit("5px");
e.Row.Cells[2].Width = new Unit("150px");
e.Row.Cells[3].Width = new Unit("150px");
e.Row.Cells[4].Width = new Unit("150px");
e.Row.Cells[5].Width = new Unit("150px");
e.Row.Cells[6].Width = new Unit("150px");
// and so on
}
}
,纔有可能設置單元格的高度呢? 謝謝!
我認爲它的ASP.NET不是asp-classic標記的, – Habib 2013-03-27 06:04:07
我試着用e.Row.Cells [0] .Height = new Unit(「25px」);但它並沒有真正改變行的高度 – user1781830 2013-03-27 06:09:08
請嘗試:e.Row.Cells [0] .Height = 25; – 2013-03-27 07:30:17