I have 3 properties on my user control that the aspx page sets. Once the user control page gets called whats the best way to save these values? Should it be saved to hidden fields, Sessions?
If this is a public property with set/get attributes you can access it from your UserControl. Why do you need to save them separately? What exactly you're trying to achieve?
I don't have this problem for my UserControls. However, all my textboxes/dropdownlists have EnableViewState property set to true. I guess if you set this property to false you may lose values.
and if the user control is added to the page at runtime (vs. design time) if it's added at runtime make sure you add it in the Init event and assign the control an ID. Then viewstate will work properly with the control. (also if adding the control at runtime it must be added with each postback).
viewstate is enabled by default. this can be overriden in a number of places though.
web.config
page declaration
page codebehind
user control declaration
user control codebehind
post the relative code for the page and user control and we may be able to diagnose this better.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.