Saturday, February 19, 2011

Consuming a "Table of data" in Silverlight

Since silverlight does not have any support for DataSets/DataTables, what would be the best approach if I wanted to consume a table of data from a database?

A bit like this: user action in silverlight -> get data from server -> display in GridView

The thing is, I do NOT know how many and which columns the data will have...

Can I bind the DataGrid to some loose form of XML, generated on the server or will I have to parse The datasets returned by the webservice myself in another format or ... ?

From stackoverflow
  • One approach that is working for me is the following one I just found: http://blog.bodurov.com/How-to-bind-Silverlight-DataGrid-from-IEnumerable-of-IDictionary

    By consuming the XML file, and putting the data in a List of Dictionary objects (the list is the records and the dictionary per listitem is the fieldlist with value) I can use the method in the URL above to dynamically create objects. With these objects I can fill the GridView.

0 comments:

Post a Comment