0

I can't pass a variable to an user control (ascx) from an asp page (aspx) within a loop.

I want to recursively iterate a custom control with a foreach loop (would like to avoid asp:Repeater, but if it's the only solution I'm open to suggestions about that.

I Used all the server inline tags I know, but result either gets the full

<%= stringvalue %>

to the control (meaning in the string variable which receives the parameter in the control, I see the expression and not the value) or null when I use binding tags

<%# stringvalue %>

Here's what I'm doing in the aspx file:

<%foreach (string item in listItems)
                    {
                        tempItem = item;
                        %>
                    <uc:CustomControl runat="server" id="controlId" AutoPostback="true" parameterCustom='<%# Eval("tempItem")%>'/>

                <%
                    }%>

And in the control I have

public string parameterCustom {get;set;}

which should receive the value

Liquid Core
  • 1
  • 6
  • 27
  • 52

0 Answers0