Posted 24 October 2024, 12:15 am EST
Hello.
I would like to directly insert the dataset into the flex grid like a winform.
(ex) grid.datasource = dataset;)
Please include the source code.
Thank you.
Forums Home / ComponentOne / Blazor Edition
Posted by: soraroid on 24 October 2024, 12:15 am EST
Posted 24 October 2024, 12:15 am EST
Hello.
I would like to directly insert the dataset into the flex grid like a winform.
(ex) grid.datasource = dataset;)
Please include the source code.
Thank you.
Posted 24 October 2024, 12:09 pm EST
Hi,
You could refer to the attached sample that shows setting the items source of the FlexGrid. It is similar to the following docs: https://developer.mescius.com/componentone/docs/blazor/online-blazor/flexgrid_quickstart.html
FlexGrid Demo: https://developer.mescius.com/componentone/demos/blazor/blazorexplorer/FlexGrid/SelectionModes
Let me know if you face any issues.
Regards,
Ankit
Posted 25 October 2024, 4:22 am EST
I checked the source you provided.
However, the source is structured to put an array in the item source, but what I want is to put it in the form of dataset.tables[0], not array.
Please review again.
Thank you.
Posted 25 October 2024, 6:36 am EST
Hi,
The “ItemsSource” property must be collection of items. Refer to the following definition of ItemsSource property: https://developer.mescius.com/componentone/docs/blazor/online-blazor/C1.Blazor.Grid~C1.Blazor.Grid.FlexGrid~ItemsSource.html
The type must be IEnumerable ( https://learn.microsoft.com/en-gb/dotnet/api/system.collections.ienumerable?view=net-8.0)
I am not sure about what you refer by “dataset.tables[0]” . Could you kindly elaborate this? And provide a sample implementation of your use case.
In most of the cases, you could manipulate the data source to be of type IEnumerable.
Regards,
Ankit