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

How to create Hierachy Grid from Objects

2 Answers 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vuyiswa
Top achievements
Rank 2
Vuyiswa asked on 16 Aug 2010, 10:26 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 19 Aug 2010, 08:09 AM
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
0
Vuyiswa
Top achievements
Rank 2
answered on 19 Aug 2010, 10:10 AM
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
Tags
Grid
Asked by
Vuyiswa
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Vuyiswa
Top achievements
Rank 2
Share this question
or