Hello,
I've got a bit of a problem with Q2 2009 GridView. I use a child GridViewTemplate, but whenever I try to expand its row (with row.IsExpanded = true) I get a NullReferenceException at Telerik.WinControls.UI.DataGroup.get_RowCount()
at Telerik.WinControls.UI.GridViewInfo.SetViewInfoToRows(DataGroup rootGroup)
at Telerik.WinControls.UI.GridViewInfo.InitializeChildViewInfo()
at Telerik.WinControls.UI.GridViewTemplate.CreateGridViewInfo(DataGroup rootGroup, GridViewDataRowInfo parentRow)
at Telerik.WinControls.UI.GridViewDataRowInfo.SetExpanded(Boolean value)
at Telerik.WinControls.UI.GridViewRowInfo.set_IsExpanded(Boolean value).
After looking closely at what's going on I noticed that DataGroup.owner is null, and DataGroup.IsDisposed == true. I think the group gets disposed in DataAccessComponent.InitDataGrid() when I set DataMember of my ChildGridViewTemplate to null and its DataSource to a DataTable that was earlier filled with data.
After that the DataGroups never get recreated, so when I try to expand my ChildGridViewTemplate, DataGroups are still disposed (with owner set to null) and I get the exception. I also noticed that if I add new data rows to the DataTable after assigning it as DataSource than the new rows expand just fine, only the old ones throw exceptions.
So my question is, is there any way I can force the DataGrid to recreate disposed DataGroup for already existing rows ?
Regards,
Piotr Kochanowski