急!将hashtable绑定到GridView后,怎么显示其中的值?

制作购物车,代码:
GridView1.DataSource = (Hashtable)Session["basket"];
GridView1.DataBind();
在GridView中设了两个BoundField列,其中一个的DataField设为key,另一个设为value,可是什么也不显示.
[169 byte] By [xinxin12375] at [2008-1-9]
# 1
你前台怎么绑定的
试试
<%#DataBinder.Eval(Container.DataItem,"key")%>
<%#DataBinder.Eval(Container.DataItem,"value")%>
wslinfeng-林风 at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 2
<asp:GridView AutoGenerateColumns="false" ID="GridView1" runat="server"> <Columns> <asp:BoundField DataField="Key" HeaderText="Key" /> <asp:BoundField DataField="Value" HeaderText="Value" /> </Columns> </asp:GridView>
cpp2017-慕白兄 at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 3
System.Collections.Hashtable ht = new Hashtable(); ht.Add("AA", "1"); ht.Add("BB", "2"); this.GridView1.DataSource = ht; this.GridView1.DataBind();
cpp2017-慕白兄 at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...
# 4
2楼的好像是DataGrid里面的吧,我现在用的是VS2005,好像不能这样吧。
xinxin12375 at 2007-9-30 > top of Msdn China Tech,.NET技术,ASP.NET...