Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Cannot use Container.DataItem.Key to access hashtable key?


Message #1 by "Robert Mirabelle" <exceptionalBinds@h...> on Fri, 1 Mar 2002 17:05:26
The compiler returns: 'object' does not contain a definition for "key"
What am I doing wrong here?

Very simple snippet:


<html>
<head>
<script language="C#" runat="server">
	public void Page_Load(Object Sender, EventArgs E) {
		Hashtable myHash = new Hashtable(3);
		myHash.Add("Tom",1);
		myHash.Add("Dick",2);
		myHash.Add("Harry",3);
		myDataList.DataSource = myHash;
		DataBind();
	}
</script>
</head>

<body>
<ASP:DataList id="myDataList" runat="server">
<ItemTemplate>
	<%#Container.DataItem.Key%> <%#Container.DataItem.Value%>
</ItemTemplate>
</ASP:DataList>
</body>
</html>

Thanks!




  Return to Index