Is it possible to convert a xamdatagrid to a datatable?
I have a customized export function that only accepts the type DataTable, however I field my data in a XamDataGrid. Is it possible to do this conversion?
Hello Nour,
C# is a strongly typed language, so you must define types for your arguments.
However, if you do not know the type of the element, you can use a reflection to obtain it at runtime. Since this is not related to our components, I would suggest going trough MSDN forums or StackOverflow, as I am sure this has been thoroughly discussed there.
Here is an example:
https://stackoverflow.com/questions/232535/how-do-i-use-reflection-to-call-a-generic-method
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics
IT WORKED.....thanks!!!!!!
But is it possible to create a datatable without the need to specify a type
Hello,
All you have to do is to use the method provided and add the relevant input:
DataTable dt = CreateDataTable<T>(Gridx.DataSource); (T is the type of the objects in the collection)ImportExportSystem.Export export= new ImportExportSystem.Export(dt);
please bare with me a bit....how do I call it?
If this is my Data Source:
var grid = Gridx.DataSource;
and this is an export library that I designed
ImportExportSystem.Export export= new ImportExportSystem.Export(ccccccc);
But instead of ccccccc I need to put the data table.
How do I turn var grid to datatable?
The method in my previous reply does that. It takes as argument a collection of any type and returns a DataTable. If there is anything unclear in the method I have posted, please let me know.