Hello People!
Could you please explain how to organize communication between user controls? Let's say we have a page where 2 UCs (statusbar and button) are being loaded using LoadControl() function.
Statusbar consists of <asp:Label /> and Button of <asp:Button />
How to change content of a label if you hit a button?
Thank you very much in advance!
-
-
On the buttons click event you should be able to do something like:
(base.Parent.FindControl("LabelIdGoesHere") as Label).Text = "HELLO"; -
Make public properties to user controls and they can be accessed from the container pages code behind easier.
uc.ascx.cs:
private string foo;
public string Foo
{
get { return foo; }
set { foo = value; }
}
Container.aspx.cs:
controlInstance.Foo = "Hello";
HTH.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.