PDA

View Full Version : problem with control in Repeter control???


cool_man77
08-22-2004, 09:51 AM
I have put the label control(myLabel) in the list control(myRepeter)

<asp:Repeater id="myRepeter" runat="server">
<ItemTemplate>
<asp:label id="myLabel" runat="server"/><%# Container.DataItem("Item") %>
</ItemTemplate>
</asp:Repeater>

I want to access to "myLabel" properties like: Text, BackColor.. in Page_Load sub. I had use:

Sub Page_Load(s as Object, e as EventArgs)
myLabel.Text = "Hello"
End Sub

But I receive error "Name 'myLabel' is not declared."

Can anyone help me to solve this problem, please?

Thanks!

Matthew Gambill
08-23-2004, 06:11 AM
Try using the ItemDataBound method of the repeater as each item is bound you can access it's control(s).

e.item.controls(1) it will return the label control in your example



Matt G.
NMyVision.com
Developer / Designer