It seems that it doesn't work:
<asp

ataGrid id="dgServerVariables" runat="server"
AutoGenerateColumns="False">
<AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle>
<ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="#F7F7F7"
BackColor="#4A3C8C"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Key" HeaderText="Key"></asp:BoundColumn>
<asp:BoundColumn DataField="Value" HeaderText="Value"></asp:BoundColumn>
</Columns>
</asp

ataGrid>
In code behind:
private void loadServerVariables() {
NameValueCollection coll;
// Load ServerVariable collection into NameValueCollection object.
coll = Request.ServerVariables;
dgServerVariables.DataSource = coll;
dgServerVariables.DataBind();
}
Then I get error:
A field or property with the name 'Key' was not found on the selected
datasource.
--
WWW:
http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:(E-Mail Removed)...
> You have a column named "Key" and one named "Value"
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Hardy Wang" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Hi,
>> I have a NameValueCollection, is it possible to bind this object to a
>> two-column DataGrid? How to match columns?
>>
>> Thanks!
>>
>> --
>> WWW: http://hardywang.1accesshost.com
>> ICQ: 3359839
>> yours Hardy
>>
>
>