Databind List of Dictionnary into a GridView
<p>I'd like to bind a List of Dictionary to a GridView.</p>

<pre><code>var liste = new List&lt;Dictionary&lt;string, string&gt;&gt;();
var dictionary = new Dictionary&lt;string,string&gt;();
dictionary["Id"] = "111";
dictionary["Description"] = "text to show";
dictionary["OtherInfo"] = "other text";
liste.Add(dictionary);
gvClients.DataSource = liste;
gvClients.DataBind();
</code></pre>

<p>The code in the aspx :</p>

<pre><code>&lt;asp:GridView ID="gvClients" runat="server" AutoGenerateColumns="true" GridLines="None"
  AllowPaging="True" CssClass="gridview" AlternatingRowStyle-CssClass="alt" Width="80%"&gt;
&lt;AlternatingRowStyle CssClass="alt"&gt;&lt;/AlternatingRowStyle&gt;
  &lt;Columns&gt;
    &lt;asp:TemplateField HeaderText="PropertyName"&gt;
      &lt;ItemTemplate&gt;
        &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("Description") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
    &lt;/asp:TemplateField&gt;
    &lt;asp:TemplateField HeaderText="PropertyName"&gt;
      &lt;ItemTemplate&gt;
        &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Eval("OtherInfo") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
    &lt;/asp:TemplateField&gt;
  &lt;/Columns&gt;
&lt;/asp:GridView&gt;
</code></pre>

<p>How can I bind the GridView to that Object (or a System.Collections.HashTable).</p>

<p><strong>edit</strong></p>

<p>The geek's solution for Dictionary work but not for HashTable, is there a solution ?</p>

<pre><code>var liste = new List&lt;System.Collections.Hashtable&gt;();
var table = new System.Collections.Hashtable();
table["Denomination"] = "a";
table["Denomination2"] = "an";
liste.Add(table);

var result = liste.Select(map =&gt; new
{
    IdClient = map["Denomination"],
    Denomination = map["Denomination2"]
}).ToList();

gvClients.DataSource = result;
gvClients.DataBind();
</code></pre>

<p>I've this error :</p>

<pre><code>The data source for GridView with id 'gvClients' did not have any properties or attributes from which to generate columns.
</code></pre>

<p>When I modify the mapping like this :</p>

<pre><code>var result = liste.Select(map =&gt; new
{
    IdClient = map["Denomination"],
    Denomination = map["Denomination2"],
    Test = "test"
}).ToList();
</code></pre>

<p>It will show only the Test property.</p>

<p>Thanks</p>
