1
Reply

Datagrid binding to Dictionary

Gagan Gadag

Gagan Gadag

Sep 23 2016 9:04 AM
679

I need to display tabular data in data grid. But number of columns (data) will be known only during run time, So i can not use some model class (to represents each row) and bind Collection of this model class to datagrid.

I tried using datatable where i can dynamically add columns and bind to datagrid (Autogeneratedcolumns = "true"). But the problem is when the column name has special characters some time bindings fails. (ex: Column name = "(n)").

So i want to know, is it possible to bind to Dictionary<key,List<object>> . Here Key represents column & list<object > are column values. But when i bind dictionary to datagrid, Keys are displayed as row values

?


Answers (1)