GridView自动列设置列宽
用代码给GridView加标题头,那么怎么设置它的列宽?
------解决方案--------------------
那你怎么代码给GridView加标题头的?
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
e.Row.Cells[i].Style["width"] = "200px";
}
}
}
------解决方案--------------------正解