I have strugled couple days with a problem showing three level Hierarchial data in RadGrid.
Haven't got any answers and havent' found any samples.
I use Telerik version: RadControls_for_ASP.NET_AJAX_2010_1_415_dev
Problem is following:
A) Data is in Database in following way. Database table contains Ids to Organization table
IdA IdB IdC IdD
---------------------
7 53 4 22 *
7 27 0 0
7 50 33 0
7 49 0 0
7 39 0 0
7 53 9 26 *
Rows that causes problems in RadGrid are marked with asterix.
Those rows will case duplicate rows into RadGrid.
B) I use two GridTableViews in RadGrid creating Hierarchy.
C) DetailTableDataBind is like following
protected void RadGridSubOrganizations_DetailTableDataBind(object source,
Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
string ParentOrganizationId = "";
string ChildOrganizationId = "";
string SubChildOrganizationId = "";
switch (e.DetailTableView.Name)
{
case "ChildOrganization": // Name of 1. GridTableView
{
ParentOrganizationId = Convert.ToString(dataItem.GetDataKeyValue("ParentOrganizationId"));
ChildOrganizationId = Convert.ToString(dataItem.GetDataKeyValue("ChildOrganizationId"));
e.DetailTableView.DataSource =
_presenter.GetOrganizationCustomersChildsSubChilds(long.Parse(ParentOrganizationId),
long.Parse(ChildOrganizationId));
}
break;
case "SubChildOrganization": // Name of 2. GridTableView
{
ParentOrganizationId = Convert.ToString(dataItem.GetDataKeyValue("ParentOrganizationId"));
ChildOrganizationId = Convert.ToString(dataItem.GetDataKeyValue("ChildOrganizationId"));
SubChildOrganizationId = Convert.ToString(dataItem.GetDataKeyValue("SubChildOrganizationId"));
e.DetailTableView.DataSource =
_presenter.GetOrganizationCustomersChildsSubChilds(long.Parse(ParentOrganizationId),
long.Parse(ChildOrganizationId),
long.Parse(SubChildOrganizationId));
}
break;
}
}
It seems to be so that DetailTableDataBind works ok or I thing so because duplicate Row (marked with asterix) has been created before debugger stops here.
D) I have tried to filter duplicates in in ItemCreated and ItemDataBound methods but haven't succeeded.
e.Cancelled is now supported there!!!
I also tried to use GroupExpression property in First level Columns but it didn't help.
Could I please get a working sample how to implemed Hierarchial RadGrid in situations like this?????
Our Company has license to Telerik, why can't I get support for this kind of question.
Michael