簡體   English   中英

在C#中刪除GridViewRow的頂部邊框

[英]Remove top border of GridViewRow in c#

我在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類,並為該css類添加樣式,如下所示。

.gridview
{
    border-top:none !important;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM