How to pass variable from code behind to user control
Posted on 2007-12-04
I have been looking at several options in the knowledge base, however, have not found something that fits my needs. In my code behind "myWebControl.ascx.cs" I re-direct to a user control "myUC.cs". I want to pass a variable to the user control, possibly a session variable.
I know I can do "HttpContext.Current.Session["ServerName"] = psServerID;" in my code behind, however, don't know if this will be availabe to my UC after the re-direct. Note, the UC is just a .cs file (public class UserControl2 : System.Windows.Forms.UserControl)