protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Attributes.Add("style", "border:1px solid #333333 ");
e.Row.Cells[1].Attributes.Add("style", "border:1px solid #333333 "); //#93c2f1;
e.Row.Cells[2].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[3].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[4].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[5].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[6].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[7].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[8].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[9].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[10].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[11].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[12].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[13].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[14].Attributes.Add("style", "border:1px solid #333333");
e.Row.Cells[15].Attributes.Add("style", "border:1px solid #333333");
}
}
gridview设置边框
本文介绍了一个简单的ASP.NET GridView控件的RowDataBound事件处理方法,用于为GridView中的每一行添加统一的边框样式。通过遍历每行的单元格并添加自定义样式属性,可以实现对整个表格外观的一致性和美观性的提升。

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



