开发者

ChildGridView column's Data On Binding

i am using nested gridview, on RowDatabound Event i am binding childgridview based on some condition of parentgridview column. meanwhile i need to know the column value of child gridview.how can i do that? I am using this code:-

protected void gridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if (e.Row.RowType == DataControlRowType.DataRow)
   {
      GridView gridViewchild = (GridView)e.Row.FindControl("gridView2");
      string custState = ((DataRowView)e.Row.DataItem)["CustState"].ToString();
      if (!string.IsNullOrEmpty(custState))
      {
           gridV开发者_开发技巧iewchild .DataSource = MyDataSource;
           gridViewchild .DataBind();
           //now i need to know the childgridview column's data ????
      }
   }
}


There are couple of ways you can achieve this:

1- Loop through the rows of Child GridView

foreach (GridViewRow row in childGridView.Rows)
{
     //row.Cells[index];
}

2- Use RowDataBound event of child GridView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜