ASP.Net中GridView多层嵌套,用最里层的控件获取到外层GridView

protected void ddlCode_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlCode = (DropDownList)sender;
//根据现有的控件的NamingContainer获取到该控件所在的父级GridView的所在行
GridViewRow gvr = (GridViewRow)ddlCode.NamingContainer;
   //根据获得的gvr使用同样的属性获得外层的GridView
GridView gv = gvr.NamingContainer as GridView;
  //获取gvr的行索引
  int i_RowIndex = gvr.RowIndex;
}
上一篇:C++ - 派生类访问模板基类(templatized base class)命名


下一篇:词向量之word2vec实践