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

Get the datatable of the grid

2 Answers 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Farouk
Top achievements
Rank 1
Farouk asked on 25 Feb 2009, 10:14 AM
Is there a possibility to get the datatable that is set in the radgrid, when i set the datasource..

my problem is that i have a generic list, but i can't save the list in viewstate(no serialization) so i that i can hold my temp data..

okay i can manually fill a datatable with the list-values at first load and save the table in viewstate, but it is so ugly :D and this scenario looks so daily...

thx 4 help
basti

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 27 Feb 2009, 05:35 PM
Hello Bastian,

If I understand you correctly, you need to save the custom collection to which the grid is bound in DataTable type. If my understanding is right, there is no easy way of doing this. The grid does not alter the data source type. Hence if you bind it to custom collection, you can retrieve the same custom collection.

The only way to fill DataTable object is to do it manually, as you loop the whole custom collection. You can use reflection for this purpose, but this will decrease the performance and will conflict with medium trust server settings. Here is one code library from CodeProject which demonstrates the required functionality.

Regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Farouk
Top achievements
Rank 1
answered on 12 Mar 2009, 10:52 AM
ok, i found an other way, but i thought it gives a way like in the datagrid (winForm), where i can get the table from view...
Tags
Grid
Asked by
Farouk
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Farouk
Top achievements
Rank 1
Share this question
or