I have this ListView that displays a user control. A custom user control has the MyObject property. When I bind the MyObjects collection to a ListView, the only way I can pass MyObject to a user control, which I think is to make the collection a Dictionary<MyObject,string> and put Eval("Key") in the markup.
My question is: how to skip this step of the dictionary? Is there an Eval("this") equivalent 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>
source share