How to create Hierachy Grid from Objects

3 posts, 1 answers
  1. Vuyiswa Maseko
    Vuyiswa Maseko avatar
    187 posts
    Member since:
    Jan 2010

    Posted 16 Aug 2010 Link to this post

    Good Day All

    I have a Class that is defined like this

    namespace EAVV
    {
        public class EAV
        {
     
            private string _Attribute;
            private string _Value;
     
     
     
            public string Attribute
            {
                get
                {
                    return _Attribute;
                }
     
                set
                {
                    _Attribute = value;
                }
     
            }
     
            public string Value
            {
                get
                {
                    return _Value;
                }
                set
                {
                    _Value = value;
                }
     
            }
     
            public EAV(string AttributeEA, string ValueEA)
            {
                this._Attribute = AttributeEA;
                this._Value = ValueEA;
     
            }
     
            public EAV()
            {
     
     
            }
     
        }
    }

    And I have another one to process this like this

    namespace EAVV
    {
        public class EAVProcess
        {
     
            public List<EAV> GetRecords(List<string> ParentRecords,List<string> ChildRecords)
            {
              List<EAV> Final= new List<EAV>();
     
              for (int i = 0; i < ParentRecords.Count; i++)
              {
     
                  for (int J = 0; J < ChildRecords.Count; J++)
                  {
                      Final.Add(new EAV(ParentRecords[i], ChildRecords[J]));
                  }
              }
     
              return Final;
            }
     
            public EAVProcess()
            {
            }
        }
    }

     

    And as you can see this will return a list. So I am binding my Grid(Telerik) which is the same as binding the normal asp.net grid like this

     

    RadGrid1.DataSource = EAVobj.GetRecords(ParentRecordsRow, ChildRecordsField);
    RadGrid1.DataBind();

    And I get the Following Data

    from the Image, You can see there is an Attribute Column and there is a Value Column, Now what i want to do is that i want to have only one Country and one Event in the Attribute and the Values must be nested underneath each other in a Grid, so basically i need a nested View and the Attribute is the parent and the Values will be grouped according to their parent.

  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 19 Aug 2010 Link to this post

    Hello Vuyiswa,

    You can use RadGrid grouping functionality in order to achieve the desired layout. I have attached a small sample which demonstrates a possible implementation of such approach.

    Regards,
    Rosen
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vuyiswa Maseko
    Vuyiswa Maseko avatar
    187 posts
    Member since:
    Jan 2010

    Posted 19 Aug 2010 Link to this post

    Good Day Admin

    I would like to say you saved my life. My Bosses love telerik and we are going all out with it and we will not hesitate to recommend it to other , one of the biggest banks in South Africa(Nedbank) they love it and i demonstrated it to them and you might get a call from them and i told them about the support you give on the forum. Without you guys we will be sitting with primitive Microsoft controls that have limitation. Thank you again for your support we moved all out from your competitors (Infragistics,DevExpress,Dundas and ComponentUi) and we are going to use Telerik in everything.

    I believe Microsoft is proud of you.

    Keep up the good work.

    Vuyiswa Maseko
Back to Top