U
u3k
I've been struggling for a day and yet haven't found a solution to
such a problem:
I have, let's say, an apsx page, which contains a UserControl, which
adds to it's Controls collection a new control, dynamically loaded via
LoadControl, which in order is also a UserControl, visually designed.
When I init this 'dynamic control', i set properties of this 'dynamic'
control's subscontrols (textboxes, labels - all WebControls), on first
load i see this initial, desired, values. But then, after a post back
- those initial value are lost. All viewstate stuff is set properly
thru the whole hierarcy of controls. The weird thing is that even if I
add any text to textboxes containig initial values in browser, e.g.
Initial value was 'Default', and i type up to the end of the string
'!!!!', after postback i get in textbox just '!!!!'.... Seems like
viewstate is restored but in some irrational way - only what is
received in postback! More: even if i will mix the parts of initial
value in browser text box, for example - switch part of the phrase via
cut and paste, theese parts also will be removed from viewstate. And
more: if i'll retype the exact string in browser textbox, the same
that was written in intialization part, but before that _clear_
(DEL-DEL-DEL textbox's contents, the string _typed_ is restored...
such a problem:
I have, let's say, an apsx page, which contains a UserControl, which
adds to it's Controls collection a new control, dynamically loaded via
LoadControl, which in order is also a UserControl, visually designed.
When I init this 'dynamic control', i set properties of this 'dynamic'
control's subscontrols (textboxes, labels - all WebControls), on first
load i see this initial, desired, values. But then, after a post back
- those initial value are lost. All viewstate stuff is set properly
thru the whole hierarcy of controls. The weird thing is that even if I
add any text to textboxes containig initial values in browser, e.g.
Initial value was 'Default', and i type up to the end of the string
'!!!!', after postback i get in textbox just '!!!!'.... Seems like
viewstate is restored but in some irrational way - only what is
received in postback! More: even if i will mix the parts of initial
value in browser text box, for example - switch part of the phrase via
cut and paste, theese parts also will be removed from viewstate. And
more: if i'll retype the exact string in browser textbox, the same
that was written in intialization part, but before that _clear_
(DEL-DEL-DEL textbox's contents, the string _typed_ is restored...