Question

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?

Was it helpful?

Solution

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;}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top