How do I use Eval() to reference values in a SortedDictionary in an asp Repeater?

Posted by MatthewMartin on Stack Overflow See other posts from Stack Overflow or by MatthewMartin
Published on 2009-07-09T14:01:12Z Indexed on 2010/04/03 6:13 UTC
Read the original article Hit count: 289

Filed under:
|
|
|

I thought I was clever to switch from the memory intensive DataView to SortedDictionary as a memory efficient sortable data structure. Now I have no idea how get the key and value out of the datasource in the <%# or Eval() expressions.

SortedDictionary<int, string> data = RetrieveNames();
rCurrentTeam.DataSource = data;
rCurrentTeam.DataBind();

<asp:Repeater ID="rNames" runat="server">
 <ItemTemplate>
  <asp:Label ID="lblName" runat="server" Text='<%# Eval("what?") %>' />
 </ItemTemplate>
</asp:Repeater>

Any suggestions?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET