【发布时间】:2018-07-23 16:17:54
【问题描述】:
我在 gridview 的 rowcreated 事件中添加行控件,并且需要删除顶部边框线。
GridViewRow HeaderGridRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
TableCell HeaderCell = new TableCell();
HeaderCell.Text = strTotalRecords;
HeaderCell.HorizontalAlign = HorizontalAlign.Left;
HeaderCell.BorderStyle = BorderStyle.None;
HeaderGridRow.Cells.Add(HeaderCell);
HeaderGridRow.BackColor = Color.White;
gvGrid.Controls[0].Controls.AddAt(totalRowIndex, HeaderGridRow);
我正在使用下面的代码来删除边框,但它不起作用。
HeaderCell.Attributes.CssStyle.Add("border-top", "none");
HeaderCell.Attributes.CssStyle.Add("border-top-style", "none");
HeaderGridRow.Attributes.CssStyle.Add("border-top", "none");
HeaderGridRow.Attributes.CssStyle.Add("border-top-style", "none");
请建议我如何处理。
【问题讨论】:
-
你应该在客户端使用 css 而不是服务器端。
标签: c# css asp.net .net gridview