How to use Rowspan in Gridview for 1st Column only

前端 未结 3 1971
遥遥无期
遥遥无期 2020-12-17 20:47

Need help to resolve a issue related with Gridview layout. I am trying to implement custome Gridview with Itemtemplate Columns using C#.Net language and want to include view

3条回答
  •  遥遥无期
    2020-12-17 21:42

    Use RowDataBound event instead:

    void GridView31_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow )
        {
            if (e.Row.RowIndex % 4 == 0)
            {
                e.Row.Cells[0].Attributes.Add("rowspan", "4");
            }
            else
            {
                e.Row.Cells[0].Visible = false;
            }
        }
    }
    

提交回复
热议问题