Passing values from one Usercontrol to another UserControl!
Hi guys.
I have a ParentPage that contains 4 custom controls and I have a dropdown of users on each control. whenever I change the selected index, all custom controls should be populated according to the selected user value. Can anyone kindly tell me how to pass values to another user control at the same time? Thank!!!!!
+2
Shaitender singh
source
to share
1 answer
You can create a base UserControl class with common properties. The properties would have to wrap a session variable that is common to everyone.
eg:
public string Text
{
get
{
if (Session["UserControlText"] == null || Session["UserControlText"].ToString().Trim() == String.Empty)
{
Session["UserControlText"] = String.Empty;
}
return Session["UserControlText"].ToString().Trim();
}
set
{
Session["UserControlText"] = value;
}
}
+3
Mark redman
source
to share