D
Dominic
This post is not without research. I have an informed understanding
of the Viewstate concept, but I'm missing something fundamental.
Here's what I've got:
Control properties not explicitly defined in page design, those not
included in the http post, or those that have changed should be stored
and persisted through viewstate.
Now when it comes to dynamic controls, I'm of the understanding that
all properties of dynamic controls are persisted in viewstate as long
as on postback they are added at the same position in the control
tree.
Testing this understanding in the most simple case, I'm proven wrong.
With a page design of a placeholder, and a button for postback, my
page_load code is:
Dim MyLabel As Label = New Label
If Not IsPostBack Then MyLabel.Text = "Hello World"
PlaceHolder1.Controls.Add(MyLabel)
When clicking the button on the page, the label goes blank, meaning
the initial .text value for the label was not saved and persisted. Am
I only under the mistaken assumption that this should be implicit and
rather, I am to create a custom label control whereas I need to
override all properties I want persisted and manually manage
Viewstate? Or am I missing something?
of the Viewstate concept, but I'm missing something fundamental.
Here's what I've got:
Control properties not explicitly defined in page design, those not
included in the http post, or those that have changed should be stored
and persisted through viewstate.
Now when it comes to dynamic controls, I'm of the understanding that
all properties of dynamic controls are persisted in viewstate as long
as on postback they are added at the same position in the control
tree.
Testing this understanding in the most simple case, I'm proven wrong.
With a page design of a placeholder, and a button for postback, my
page_load code is:
Dim MyLabel As Label = New Label
If Not IsPostBack Then MyLabel.Text = "Hello World"
PlaceHolder1.Controls.Add(MyLabel)
When clicking the button on the page, the label goes blank, meaning
the initial .text value for the label was not saved and persisted. Am
I only under the mistaken assumption that this should be implicit and
rather, I am to create a custom label control whereas I need to
override all properties I want persisted and manually manage
Viewstate? Or am I missing something?