2017-04-07 52 views
-1

我正在研究asp.net C#webforms gridview。这个gridview完全是由后面的代码创建的。我必须在此控件的页脚处添加四个按钮。我想知道是否有办法从页脚中删除水平线以及将整个页脚作为单个单元格?目前我在页脚中添加按钮,如下所示。如何删除asp.net gridview中的垂直线

if (e.Row.RowType == DataControlRowType.Footer) 
{ 
    e.Row.Cells[1].Controls.Add(myButton); 
} 

这增加了单元格内的按钮。我希望没有垂直线的页脚和全部四个按钮彼此靠近并处于中心位置。

感谢

+0

你可以解释一下你的情况多一点......也许如果你张贴你当前的结果与期望的结果的图片? – Hackerman

回答

0

您可以申请colspan到GridView行的OnRowDataBound事件。

if (e.Row.RowType == DataControlRowType.DataRow) 
{ 
    //span the first cell 3 columns 
    e.Row.Cells[0].ColumnSpan = 3; 

    //remove the next cell twice 
    e.Row.Cells.RemoveAt(1); 
    e.Row.Cells.RemoveAt(1); 
} 

不知道你的水平线条,它可能是CSS,但这是不可能肯定地说没有更多的信息。

+0

而不是RemoveAt,我做了e.Row.Cells [1到3] .Visible = false; – Massey