<asp:label> reverting to initial value

  • Thread starter Thread starter mark.norgate
  • Start date Start date
M

mark.norgate

Why oh why does my <asp:label> revert to its initial value, having been
changed programmatically, when I click a button in a user control I
have added dynamically to the page? It's EnableViewState is set to
true.

Mark
 
Why oh why does my <asp:label> revert to its initial value, having been
changed programmatically, when I click a button in a user control I
have added dynamically to the page? It's EnableViewState is set to
true.

How is it being populated initially...?
 
Did you forget to use IsPostBack to avoid re-initialization?

OR

If the control is dynamically added control, then add the control on
Page PreInit, such that view state will be populated for the control.
Controls view state will be populated on subsequent TrackViewState
call.

Hth,
Ramu
 
It is being populated on the .aspx page directly, using the Text
attribute of the Label class. I'm not setting its initial value in
code.

Mark
 
Neither of those applies, since it's initial value is not set it code,
and it is not dynamically added.

Mark
 
Back
Top