I have this ListView that displays a custom user control.
The custom user control has a property MyObject.
When i databind the collection of MyObjects to the ListView, the only way to pass the MyObject to the custom user control that i can think of is to make the collection a Dictionary<MyObject,string> and to put the Eval("Key") in the markup.
My question is: how do i skip this dictionary step? Is there a equivalent of Eval("this")
<asp:ListView ID="ListViewSearchInputs" runat="server">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<uc:SearchFieldInput runat="server" MyObject='<%# Eval("Value") %>' />
</ItemTemplate>
</asp:ListView>
<asp:LinkButton runat="server" ID="LinkButtonAddFieldQuery" OnClick="ButtonAddFieldQueryClick" Text="Add New QueryField" >
</asp:LinkButton>
Try
Container.DataItemwhich should give you the current item being data bound.