Bind NameValueCollection to GridView?

Posted by Xabatcha on Stack Overflow See other posts from Stack Overflow or by Xabatcha
Published on 2008-10-20T02:13:44Z Indexed on 2010/03/30 21:13 UTC
Read the original article Hit count: 365

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

Code in aspx.cs

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

Code in aspx

<asp:GridView ID="resultGV" runat="server" AutoGenerateColumns="False" Width="100%">
    <Columns>
         <asp:BoundField DataField="Key" HeaderText="Key" />
         <asp:BoundField DataField="Value" HeaderText="Value" />
    </Columns>
</asp:GridView>

Any tip most welcome. Thanks. X.

© Stack Overflow or respective owner

Related posts about namevaluecollection

Related posts about databinding