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

Code snippet for radGrid based on table

1 Answer 14 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 20 Dec 2011, 06:24 PM
Hi,

I have an access db with say 20 tables and a radDropDownList showing them. On the event SelectedIndexChanged of the radDropDownList I would like to reconstruct radGrid layout so that the radGrid now reflects the selected table and its data.

It would be like simulating ms Access but not needing access installed and being able to make a few minor data changes.

Does anyone have something like this they care to share?

Thanks,

Karl

1 Answer, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 23 Dec 2011, 10:18 AM
Hi Karl,

Thank you for writing.

One scenario to achieve this is to fill a DataSet with all the tables from the access database and use the data set to bind the grid and drop down. When the user is done editing you can commit the changes back into the database. The provider you use to read/write the data from/to the database is up to you. Once you have the DataSet set up, you can bind the drop down list to the tables collection of the data set. On the SelectedIndexChanged event of the drop down you should bind the grid to a different table from the data set. Please find attached a sample project where I create a DataSet with two tables and mimic the scenario you have described.

I hope you will find this useful. If you have further questions, I would be glad to help.

All the best,
Ivan Petrov
the Telerik team

Q3’11
of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
GridView
Asked by
Karl
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Share this question
or