<p>What kind of collection I should use to convert NameValue collection to be bindable to GridView?
When doing directly it didn't work.</p>

<p><strong>Code in aspx.cs</strong></p>

<pre><code>  private void BindList(NameValueCollection nvpList)
  {
     resultGV.DataSource = list;
     resultGV.DataBind();
  }
</code></pre>

<p><strong>Code in aspx</strong></p>

<pre><code>&lt;asp:GridView ID="resultGV" runat="server" AutoGenerateColumns="False" Width="100%"&gt;
    &lt;Columns&gt;
         &lt;asp:BoundField DataField="Key" HeaderText="Key" /&gt;
         &lt;asp:BoundField DataField="Value" HeaderText="Value" /&gt;
    &lt;/Columns&gt;
&lt;/asp:GridView&gt;
</code></pre>

<p>Any tip most welcome. Thanks. X.</p>

Can you use Dictionary<string,string> instead of NameValueCollection.  Since Dictionary<T,T> implements IEnumerable you could use LINQ as so:
```
```
resultGV.DataSource = from item in nvpDictionary
                      select new { Key = item.Key, Value = item.Value };
resultGV.DataBind();
```
```
[EDIT] Actually you may be able to use Dictionary directly as:
```
```
resultGV.DataSource = nvpDictionary;
resultGV.DataBind();
```
```
If it doesn't map key/value the way you want you can always go back to LINQ.  LINQ would also allow you to rename the fields to whatever you want.
[EDIT]  If you can't change to use Dictionary<T,T>, make a copy of the NameValueCollection as a Dictionary in the method and bind to it.
```
```
private void BindList(NameValueCollection nvpList)
{
   Dictionary<string,string> temp = new Dictionary<string,string>();
   foreach (string key in nvpList)
   {
      temp.Add(key,nvpList[key]);
   }

   resultGV.DataSource = temp;
   resultGV.DataBind();
}
```
```
If you do this a lot, you could write an extension method to convert to a Dictionary, and use it so.
```
```
public static class NameValueCollectionExtensions
{
   public static Dictionary<string,string> ToDictionary( this NameValueCollection collection )
   {
      Dictionary<string,string> temp = new Dictionary<string,string>();
      foreach (string key in collection)
      {
          temp.Add(key,collection[key]);
      }
      return temp;
   }
}

private void BindList(NameValueCollection nvpList)
{
   resultGV.DataSource = nvpList.ToDictionary();
   resultGV.DataBind();
}
```
```