Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何生成栅格视图中的最后一行';s colspan等于栅格视图中的列数_C#_Asp.net - Fatal编程技术网

C# 如何生成栅格视图中的最后一行';s colspan等于栅格视图中的列数

C# 如何生成栅格视图中的最后一行';s colspan等于栅格视图中的列数,c#,asp.net,C#,Asp.net,您好,我有一个正在创建的网格视图,我希望该网格视图的最后一行的colspan等于网格视图中的列总数 如何用c语言编程实现这一点 我试着做: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[e.Row.Cells

您好,我有一个正在创建的网格视图,我希望该网格视图的最后一行的colspan等于网格视图中的列总数

如何用c语言编程实现这一点

我试着做:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
     if (e.Row.RowType == DataControlRowType.DataRow)
        {
              e.Row.Cells[e.Row.Cells.Count-1].ColumnSpan = e.Row.Cells.Count-1;
        }
}
。。。。但那没用

这是我正在努力做的一张照片

试试这个:

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex == dt.Rows.Count - 1) //dt=Datasource
        {
            e.Row.Cells[0].ColumnSpan = dt.Columns.Count; //your text have to be in cell[0]
            e.Row.Cells[1].Visible = false; //make the other cells invisible
            e.Row.Cells[2].Visible = false;
        }
    }