We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Dictionnary to SfDataGrid

Hi, 

It's possible to transform Dictionnary<string, List<string>> in SfDatagrid. Where Columns = Keys and rows = values ? 

I'm forced to use an ObservableCollection ? 

There is a limit of rows or columns ? 

Thank's :) 


5 Replies

VP Vimal Prabhu Manohkaran Syncfusion Team July 18, 2016 01:00 PM UTC

Hi Rosemond,

Thanks for contacting Syncfusion Support.

We have checked your query “To set a Dictionary<string,List<string>> as the ItemsSource of the SfDataGrid”, this is not possible since the dictionary provides only two properties Key and Value which will be considered as the MappingName for the SfDataGrid columns. Hence only two columns will be created when a dictionary is set as itemssource to the SfDataGrid. We have prepared a sample based on your requirements where we have loaded four key value pairs as input. Please refer the screenshot below that renders the output when a dictionary is set as ItemSource to the grid.



Regards,
Vimal Prabhu



RJ Rosemond Jordan July 19, 2016 01:36 PM UTC

Ok thank's. 

So have a sample for transform XML to DataGrid ? 

With a XML like : 

<Table1>
    <nom>Null</nom>
    <IdPays>FR</IdPays>
    <IdCategorie>2</IdCategorie>
    <IdModeInscription>P</IdModeInscription>
    <IdCivilite>Null</IdCivilite>
  </Table1>
  <Table1>
    <nom>BLANCHE</nom>
    <IdPays>CI</IdPays>
    <IdCategorie>V</IdCategorie>
    <IdModeInscription>P</IdModeInscription>
    <IdCivilite>MME</IdCivilite>
  </Table1>
... 

Where each <node> except "<Table1>" are columns ? Knowing that i have a different number of node every time ? 

Thank's 



VP Vimal Prabhu Manohkaran Syncfusion Team July 20, 2016 12:42 PM UTC

Hi Rosemond,

Thanks for the update.

We have checked your query. We have prepared a sample based on your requirements where we have parsed a XML file and have set your XML data as the ItemsSource of the SfDataGrid. Please find the sample from the below link.

Sample Link : http://www.syncfusion.com/downloads/support/forum/125028/ze/XMLdata-1263811514

If your requirements are different from the solution we have provided, we kindly request you to explain your requirement in an elaborate clear way so that we can help you better.

Regards,
Vimal Prabhu


RJ Rosemond Jordan July 22, 2016 01:06 PM UTC

Thank's. 




VP Vimal Prabhu Manohkaran Syncfusion Team July 26, 2016 07:28 AM UTC

Hi Rosemond,

Thank you for your response. Please let us know if you may require further assistance.

Regards,
Vimal Prabhu
 


Loader.
Live Chat Icon For mobile
Up arrow icon