Geeks With Blogs

News My Blog has been MOVED to
Michael Freidgeim's OLD Blog My Blog has been MOVED to

It's published in a few places, but I had to do a few Google searches before confirming that you should use NamingContainer property to get parent DataGrid for DataGridItem. So I've created a shared method in my WebFormsHelper class.

    Public Shared Function ParentDataGrid(ByVal Item As DataGridItem) As DataGrid

        ' Dim gridTable As DataGridTable = Item.Parent 'DataGrid = gridTable.Parent doesn't work because  MS declared DataGridTable as private(why?)

        Dim grid As DataGrid = Item.NamingContainer

        Return grid

    End Function

Posted on Tuesday, July 18, 2006 8:47 AM ASP.NET | Back to top

Comments on this post: How to refer to parent DataGrid from DataGridItem - use NamingContainer

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: