Hi Peter,
You're nearly there. In your .aspx page, you need to get a reference to the
user control within the page and within the user control get a reference to
the label. Once all that is done, you set the text:
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim statusBar As UserControl
Dim lblFooter As Label
statusBar = Page.FindControl("MywindowFooter1")
If Not statusBar Is Nothing Then
lblFooter = statusBar.FindControl("lblStatusBar")
If Not lblFooter Is Nothing Then
lblFooter.Text = "Hi Peter"
End If
End If
End Sub
<form id="Form1" method="post" runat="server">
<uc1:MywindowFooter id="MywindowFooter1"
runat="server"></uc1:MywindowFooter>
</form>
Does this help?
Ken
Microsoft MVP [ASP.NET]
<pe***@notmail.net> wrote in message
news:pm********************************@4ax.com...
I have created an UserControl (MywindowFooter) which
contains a label-component :
<asp:label id="lblStatusBar" runat="server"></asp:label>
How can I refer to this label, from the code-behind file, to
set its Text-property ?
I already figured out that I probably should 'get' the
label-component by doing something like :
dim statusBar as System.Web.UI.Control =
MywindowFooter.FindControl("lblStatusBar")
But what to do next ? I guess I should cast statusBar
into a label-component, but I don't know how ...
Who can help me out ?