Function to get parent GridView for GridViewRow

A reference to the GridView can be obtained by using gridViewRow.Parent.Parent or (GridView) gridViewRow.NamingContainer(quote from here).

So I've created the static function:

        public static GridView GetParentGridView(GridViewRow row)
        {
            //NOTE row.Parent doesn't return GridView
            GridView gridView = (GridView)row.NamingContainer;
            return gridView;
        }
 

 

posted @ Sunday, February 24, 2008 3:56 PM

Print

Comments on this entry:

# re: Function to get parent GridView for GridViewRow

Left by Matthew Jones at 7/10/2009 7:55 AM
Gravatar
Thanks, this is exactly what I was looking for :-) You just saved me a bunch of hassle looking inside the debugger.

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345