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

create grid columns from data service

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 28 May 2014, 03:01 AM
Hi there,

I have a service that returns an object containing 2 lists.

First list is 'Columns' which contains the following "A1, B2, B3, C1, C2"
Second list is 'ItemCount' which contains the following "Name: abc, A1: 12, B2: 4, C1: 10", "Name: xyz, A1: 12, B2: 4, B3, 2", "Name: def, C1: 10"
and I want grid to display like following:

NAME           A1        B2           B3           C1            C2
abc               12         4             0             10             0
xyz               12         2              2             0              0
def                0           0             0             10            0

How can this be achieved?? please note, columns will change depending on data that is returned

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 30 May 2014, 09:26 AM
Hi Chris,

You can make avail of the AutoGenerateColumns functionality provided by RadGrid or create the grid and its columns programmatically on Page_Init:
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section22

For either of the approaches you need to strictly follow the steps provided in this article:
http://www.telerik.com/help/aspnet-ajax/grid-changing-structure-dynamically.html

Hope this helps.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or