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

Help - Auto Generate Columns At Runtime

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Harkins
Top achievements
Rank 1
James Harkins asked on 02 Mar 2010, 04:35 PM
I am using RadTools for ASP.NET 2009.Q3 SP2.

Can someone please tell me if the following possible.

I would like to build a user control (BaseGrid.ascx) that houses the Telerik RadGrid that will allow me to pass in different datasets to it based off of SQL views and or OpenAccess ORM ExtentClasses and have the grid display the columns/data automatically.  I am under the impression that the Grid's Auto Generate Columns at Runtime feature should do this however I have UNSUCCESSFULLY tried populating the grid using (OpenAccess)DirectSQL - OQL - LINQ and an OpenAccessDataSource(set at runtime).  When there are no errors then there simply in no data.

If I temporarily set the Grid's datasource to an OpenAccessDataSource and allow the columns to be built at design time then remove the DataSource but don't clear the Grid's schema then go back to dynamically setting the Grids datasource at runtime (with a method that usually results in a NO DATA TO DISPLAY message) it works and the data is there.  So for some reason the Auto Generate Columns At Runtime feature is not working.

The idea is to have a single code base for the Grid and dynamically set the columns and populate the data at runtime. 

Can someone please confirm and or point me in the right direction.

THANK YOU!

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 05 Mar 2010, 11:22 AM
Hello James,

I have followed your scenario and prepared a sample project for you demonstrating how to change the data source of a RadGrid dynamically. You can find it attached to this message.
Please note that when assigning the new data source the DataKeyNames should be changed accordingly.

Regards,
Mira
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.
Tags
Grid
Asked by
James Harkins
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or