What's the best way (if there is a way) to define a variable for use by controls on one page, but should be disposed of after navigating away from that page? Is there anything like HttpContext.Current.Items that only persists per page?
1 Answer
There's a thing called Viewstate http://msdn.microsoft.com/en-us/library/ms972976.aspx
that may provide the functionality you want. If not, try to be more specific on how do you want to use those variables.
Pageitself? You can retrieve thePageon which the controls exist from within the control itself (user or otherwise) via thePageproperty, cast it to the sub-class type, and access the variable. You could also subclassUserControlif it's just the user controls that are going to need it.Page.Items- so I'll give that a go