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)


 
 
 
Please add 3 and 8 and type the answer here:
 

Live Comment Preview:

 
«December»
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910