Frage

I have a problem, I have a listview with a web user control in it like this

    <asp:ListView ID="TestView" runat="server">
        <ItemTemplate>
            <%# Eval("ExampleData")%>
            <uc1:TestControl runat="server" id="TestControl" />
        </ItemTemplate>
    </asp:ListView>

The problem I'm trying to solve is to send the variable in ExampleData to the control on the same row.

Any ideas?

War es hilfreich?

Lösung

Define a public property on the control and pass it as argument:

<uc1:TestControl runat="server" id="TestControl" Example='<%# Eval("ExampleData")%>'/>

Inside your user control write this:

Public string Example { get; set;}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top