Hi there,
With a normal property (e.g. one not using ViewState) the value would be lost after each post back. Consider this:
if (!Page.IsPostBack)
{
myBanner.NavigateUrl = "SomeUrl";
}
What happens when NavigateUrl is a simple property and the user clicks a button on the page? The following:
1. The page loads
2. Because Page.IsPostBack is not true, the NavigateUrl is set to "SomeUrl"
3. The user clicks a button and posts back
4. Because Page.IsPostBack is now true, the NavigateUrl value is not set. Since it can't keep its own value, the previous value is lost.
When you change the property to a ViewState property, the following happens:
1. The page loads
2. Because Page.IsPostBack is not true, the NavigateUrl is set to "SomeUrl"
3. The user clicks a button and postbacks
4. Because Page.IsPostBack is now true, the NavigateUrl value is not set. However, it stored its value in ViewState in step 2, so it still contains that value.
Does that help?
Imar
|