Passing in a value to a usercontrol through a foreach loop
Posted
by
LooDaFunk
on Stack Overflow
See other posts from Stack Overflow
or by LooDaFunk
Published on 2010-12-21T13:45:49Z
Indexed on
2010/12/21
13:54 UTC
Read the original article
Hit count: 265
in my asp.net mark up I have a foreach loop that iterates through a simple list. In this foreach loop I am adding a new user control and attempting to pass in the value from the loop. However, this value just wont budge and get inside that damn control! Anyone have any suggestions?
<%foreach (userInfo i in this.items)
{ %>
<uc1:ItemControl ID="ItemControl" runat="server" UserID='<%#Eval("userID") %>'/>
<%} %>
userID is a public property in the control, when it goes to set, the value is just literally : <%#Eval("userID") %>. I've tried #Bind and =Value but nothing seems to work.
Any help would be appreciated!
© Stack Overflow or respective owner