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

[Solved] Binding RadGridView Dynamically

1 Answer 145 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vijayabhaskara Reddy
Top achievements
Rank 1
Vijayabhaskara Reddy asked on 12 Nov 2009, 07:44 AM
Hello All,

I want to bind the data dynamically to the RadGridView 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.
Please suggest how to bind this datasource to the grid.

 

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 12 Nov 2009, 10:00 AM
Hi Vijayabhaskara Reddy,

There is no problem to do that. You just have to create the grid columns based on the number of stages. I have prepared a sample application that demonstrates how you achieve that.

There is only one issue with the 2009.3.1103 binaries - you will not be able to bind to an array of strings ("string[]") and my demo application uses list of strings ("List<string>"). If you are required to use array of string instead of lists you could download this Friday's Latest Internal Build which will resolve the issue.

Hope this helps.


Best wishes,
Milan
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
GridView
Asked by
Vijayabhaskara Reddy
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or