Combining SelfReference and Relation

2 posts, 0 answers
  1. jack
    jack avatar
    1 posts
    Member since:
    Sep 2006

    Posted 11 Apr 2012 Link to this post

    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,
  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 17 Apr 2012 Link to this post

    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 >>
Back to Top