This is a migrated thread and some comments may be shown as answers.

Combining SelfReference and Relation

1 Answer 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jack
Top achievements
Rank 1
jack asked on 11 Apr 2012, 10:53 AM
Hello,
I am trying to do SelfReference and adding relation together in the grid.
I have 2 collection: ProjectTemplate and ProjectTask. Each of these 2 contains selfreference 2 each other and they also have relation between them.Checkout code snipet below.
Note: "ProjectContract" is datacontract containing these 2 collection.
"ProjectContract.TemplateContracts" is ProjectTemplate Collection and"ProjectContract.TaskContracts" is ProjectTask Collection.
radGridView1.MasterTemplate.DataSource = ProjectContract.TemplateContracts;
 radGridView1.MasterTemplate.Templates.Add(new GridViewTemplate() { DataSource = ProjectContract.TaskContracts });
 radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "ProjectTemplateId", "ParentProjectTemplateId");
 radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate.Templates[0], "ProjectTaskId", "ParentProjectTaskId");
 var relation = new GridViewRelation(radGridView1.MasterTemplate, radGridView1.MasterTemplate.Templates[0])
     {
     RelationName = "TemplateTask"
     };
relation.ParentColumnNames.Add("ProjectTemplateId");
relation.ChildColumnNames.Add("ParentProjectTemplateId");
radGridView1.Relations.Add(relation);

I am getting somewhat desirable result. I am getting self hierarchy of ProjectTemplate and relation of template and task. But i am unable to get self hierarchy of Project Task.
Please checkout image attached below for more clarification.

Thanks,

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 17 Apr 2012, 09:54 AM
Hello Jay,

Thank you for writing.

This functionality currently is not supported in RadGridView. You can have Self-Reference hierarchy mode only for the root level, but you cannot add a relation to another level with it. If more people request the same functionality, we will consider implementing it in a future release.

Here is a link to the feature request, where you can add your vote for it:  http://www.telerik.com/support/pits.aspx#/public/winforms/10735.

I have updated your Telerik points for this request.

I hope that you find this information useful.

All the best,
Julian Benkov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
jack
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or