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

[Solved] Binding Custom Source to Grid

1 Answer 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vijayabhaskara Reddy
Top achievements
Rank 1
Vijayabhaskara Reddy asked on 18 Nov 2009, 05:55 AM

Hello All,

I want to bind the data dynamically to the RadGrid control [Columns would be known at the run time only] .

The Data Source for the RadGridView is a Generic List Collection of “OperatingCondition”.

                                    public class OperatingCondition

    {

        public OperatingCondition(int stage)

        {

            this.Actual  = new string[stage];

            this.Theoritical = new string[stage];

        } 

        public string OpCondtition  { get; set;} 

        public string[] Actual { get ;  set; } 

        public string[] Theoritical{ get;  set;}          

    } 

Actual and Theoritical coulmns has to created based on the number of stages. Eg: If the stage is 3, then grid should show the 3 Actual and Theoritical values as columns in the grid and each Actual and Theoritical column headers should be grouped to show the stage number.
Please suggest how to bind this datasource to the grid.

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 20 Nov 2009, 03:19 PM
Hello,

You can handle the grid NeedDataSource event and assign its DataSource there. Please review the below online resource for more information:

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html

Additionally, you can also try this demo on what datasources the grid can be bound to. Note that you can use a wide variety of data-sources for grid structure generation, however the only requirement is that these custom objects implement the ITypedList/IEnumarable/ICustomTypeDescriptor interfaces.

Finally, going through the following articles can help you build your grid structure dynamically:

http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html
http://www.telerik.com/help/aspnet-ajax/grdchanginggridstructuredynamically.html

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Vijayabhaskara Reddy
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or