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

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";
}
}
}
------解决方案--------------------
正解
探讨
那你怎么代码给GridView加标题头的?

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
for (int i = 0; i < e.Row.Cells.Co……