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:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678