Hello,
I have created a hierarchical RADGrid which seems for the most part to be working fine. The issue that I am having is with sorting the rows in the child table. First, let me show how data is being bound:
Now when I try to sort the child table, I receive the error: Object reference not set to an instance of an object.
e.DetailTableView.DataSource = ((SaleAnalysisRow)e.DetailTableView.ParentItem.DataItem).Details; Line 102:
}
Obviously the "ParentItem" is null, but I am unsure how to proceed at this point to fill that object and sort the data in the child grid.
Thank you.
I have created a hierarchical RADGrid which seems for the most part to be working fine. The issue that I am having is with sorting the rows in the child table. First, let me show how data is being bound:
protected void rgSalesAnalysis_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
bool ByCode = rbSoldSummary.Checked;
if (ByCode)
{
rgSalesAnalysis.MasterTableView.GetColumn("First").HeaderText = "Barcode";
rgSalesAnalysis.MasterTableView.DetailTables[0].GetColumn("Second").HeaderText = "Location";
}
else
{
rgSalesAnalysis.MasterTableView.GetColumn("First").HeaderText = "Location";
rgSalesAnalysis.MasterTableView.DetailTables[0].GetColumn("Second").HeaderText = "Barcode";
}
List<
SaleAnalysisRow
> analysisData = sa.GetAnalysisData(ByCode, ....)ToList();
rgSalesAnalysis.DataSource = analysisData;
}
//----------------------------------------------------------------------------------------------------------------------------
protected void rgSalesAnalysis_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
e.DetailTableView.DataSource = ((SaleAnalysisRow)e.DetailTableView.ParentItem.DataItem).Details;
}
Now when I try to sort the child table, I receive the error: Object reference not set to an instance of an object.
e.DetailTableView.DataSource = ((SaleAnalysisRow)e.DetailTableView.ParentItem.DataItem).Details; Line 102:
}
Obviously the "ParentItem" is null, but I am unsure how to proceed at this point to fill that object and sort the data in the child grid.
Thank you.