Shaitender Singh
Shaitender Singh

Reputation: 2207

Passing values from one Usercontrol to another UserControl !

hie guys.

I have ParentPage which contains 4 user controls and i have user dropdown on each control. whenever i change the selected index .. all user control should populate according to the selected value of user. Can anyone kindly tell me.. how to pass the values to different usercontrol at same time ... Thanks !!!!!

Upvotes: 2

Views: 2213

Answers (1)

Mark Redman
Mark Redman

Reputation: 24535

You could create a UserControl base class with the common properties. The properties would need to wrap a session variable, which would be common to each.

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;
            }
        }

Upvotes: 3

Related Questions