This is a migrated thread and some comments may be shown as answers.
Where to get working sample: Hierarchial data in RadGrid
1 Answer 23 Views
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 02 Nov 2010, 09:45 AM
Hello,

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



1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 05 Nov 2010, 09:57 AM
Hi Mike,

If you want to avoid duplicate records in RadGrid you should filter the datasource before you pass it to the grid in NeedDataSource and DetailTableDataBind. It is by design that the ItemDataBound and ItemCreated are not cancellable as they are thrown after the associated action has already taken place.

As for your support options, currently our system does not recognize this account as a licence developer's one, so please contact the RadControls licence holder in your company and ask them to add you as a developer to this licence, so you can open support tickets.

Best wishes,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or