This code sends back the selectedvalue of a dropdownlist to itself
(postabck).
But the value (dd in the code) is empty.
I must say: it works with EnableViewState="true".
My question is: dropdownlist control doesn't need viewstate for keeping the
value when the ListItems are put declaratively. Why not when the ListItems
are put programmatically?
Thanks
Bartif a select is declared declaratively, on postback the item values are
set in oninit by the code the form generates.
if you dynamically update the list, you need to also do it in oninit of
the postback.
if viewstate is enabled, the list is stored in viewstate, and the
control reloades the list in onviewstate load. also the render value is
saved, so the onchange event can be fired.
-- bruce (sqlwork.com)
Bart wrote:
Quote:
Originally Posted by
Hi,
>
This code sends back the selectedvalue of a dropdownlist to itself
(postabck).
But the value (dd in the code) is empty.
I must say: it works with EnableViewState="true".
>
My question is: dropdownlist control doesn't need viewstate for keeping the
value when the ListItems are put declaratively. Why not when the ListItems
are put programmatically?
>
Thanks
Bart
>
>
If you put them in programmatically, in the page load, it reloads every time
the page posts back
You must surround the loading of the ddl with an postback block (if not
page.ispostback then...)
--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://iWritePro.com
"Bart" <b@.swrote in message
news:%23vzxrKioHHA.4196@.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
Hi,
>
This code sends back the selectedvalue of a dropdownlist to itself
(postabck).
But the value (dd in the code) is empty.
I must say: it works with EnableViewState="true".
>
My question is: dropdownlist control doesn't need viewstate for keeping
the value when the ListItems are put declaratively. Why not when the
ListItems are put programmatically?
>
Thanks
Bart
>
Thanks to both
"David Wier" <davidwier@.davidwier.nospam.comschreef in bericht
news:epMuOPjoHHA.3880@.TK2MSFTNGP04.phx.gbl...
Quote:
Originally Posted by
If you put them in programmatically, in the page load, it reloads every
time the page posts back
You must surround the loading of the ddl with an postback block (if not
page.ispostback then...)
>
--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://iWritePro.com
>
>
>
"Bart" <b@.swrote in message
news:%23vzxrKioHHA.4196@.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
>Hi,
>>
>This code sends back the selectedvalue of a dropdownlist to itself
>(postabck).
>But the value (dd in the code) is empty.
>I must say: it works with EnableViewState="true".
>>
>My question is: dropdownlist control doesn't need viewstate for keeping
>the value when the ListItems are put declaratively. Why not when the
>ListItems are put programmatically?
>>
>Thanks
>Bart
>>
>
>
0 comments:
Post a Comment