When I inspect the GridCommandEventArgs event args in the OnItemCommand event handler I find...
e.Item.OwnerID "ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_myControl_gvMyGridWithTheDetailsTable_ctl00_ctl06_Detail10" string
and
e.Item.OwnerTableView.ClientID "ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_myControl_gvMyGridWithTheDetailsTable_ctl00_ctl06_Detail10" string
However ...
((RadGrid)sender).MasterTableView.DetailTables[0].ClientID "" string (IT'S BLANK!)
and
gvMyGridWithTheDetailsTable.MasterTableView.DetailTables[0].ClientID "" string (IT'S ALSO BLANK!)
gvMyGridWithTheDetailsTable == sender true bool
and
gvMyGridWithTheDetailsTable.MasterTableView.DetailTables[0] == ((RadGrid)sender).MasterTableView.DetailTables[0] true bool
as you'd expect, but..
e.Item.OwnerTableView == ((RadGrid)sender).MasterTableView.DetailTables[0] ***false*** bool
and yes there's only one details table....
((RadGrid)sender).MasterTableView.DetailTables.Count 1 int
What's going on here?
Why aren't the instances of the GridTableView in the GridCommandEventArgs and the GridTableView of the sending datagrid the same?
Why don't they have the same property values?
I'm attempting customise viewstate for my datagrid, by disabling viewstate on the grid and saving the state I want kept manually. I was hoping to write generic code for this that would work with RadGrids which have DetailTables. In the case of the Detail tables, not being able to correlate the ID of the grid being sorted in the OnItemCommand with the ID of anything in the Pre_Load event of the page is going to stop me from being able to restore the state for the grid.