nested gridview get parent row

后端 未结 5 1828
执笔经年
执笔经年 2021-01-20 22:04

I am using Nested GridViews where each row in the gridview has child gridView. I am using RowDataBound Event of Parent GridView, to Bindin

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-20 22:43

    You have to go 4 steps back and get the parent row like this

    protected void gvChild_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    GridViewRow gvMasterRow = (GridViewRow)e.Row.Parent.Parent.Parent.Parent;
                }
            }
    

提交回复
热议问题