Using callback, I fill dorpdownlist without postback but it gets empty when a postback is executed

Using callback, I fill dorpdownlist without postback but it gets empty when a postback is executed

am 19.01.2008 14:43:42 von Fabio Mastria

Hi all!

In a my simple project I use callback to fill a dropdownlist with xml data
returned by a web service, based on a value which is input via another
dropdownlist.

NOTE: I can't use ajax/atlas.

Using javascript and callback all works... but if I press a button or any
event that raise a postback, the dropdownlist that I fill gets empty!

This also if I set its EnableViewstate property to false.

Someone can help me?

Thank you and regards
F.

RE: Using callback, I fill dorpdownlist without postback but it gets e

am 19.01.2008 18:27:01 von jignesh

Is Button a HTML Submit Button or a normal HTML Button. ?

Regards
JIGNESH

"Fabio Mastria" wrote:

> Hi all!
>
> In a my simple project I use callback to fill a dropdownlist with xml data
> returned by a web service, based on a value which is input via another
> dropdownlist.
>
> NOTE: I can't use ajax/atlas.
>
> Using javascript and callback all works... but if I press a button or any
> event that raise a postback, the dropdownlist that I fill gets empty!
>
> This also if I set its EnableViewstate property to false.
>
> Someone can help me?
>
> Thank you and regards
> F.
>
>

RE: Using callback, I fill dorpdownlist without postback but it gets e

am 19.01.2008 18:54:01 von pbromberg

The reason why ViewState isn't working for you is that you are populating the
dropdownlist in the browser with client script. Since there is no postback
event from this, nothing gets stored in Viewstate. So in order to handle this
you would need to repopulate your dropdown if there is a postback. The server
- side code has no knowledge of the

RE: Using callback, I fill dorpdownlist without postback but it ge

am 19.01.2008 19:01:01 von mily242

Howdy,

I don't think it matters as he populates drop down list on the client side
using callback (XMLHttpRequest) AJAX, so the information is not persited in
viewstate, the only information being sent back to the server with HTML form
is selected value. He'd have to either serialize values to hidden field and
deserialize it on the aspx page and populate the drop down list, or populate
drop down after every postback on the client side. Fabio if you need more
explanation please don't hesitate to let us know.

Regards
--
Milosz


"JIGNESH" wrote:

> Is Button a HTML Submit Button or a normal HTML Button. ?
>
> Regards
> JIGNESH
>
> "Fabio Mastria" wrote:
>
> > Hi all!
> >
> > In a my simple project I use callback to fill a dropdownlist with xml data
> > returned by a web service, based on a value which is input via another
> > dropdownlist.
> >
> > NOTE: I can't use ajax/atlas.
> >
> > Using javascript and callback all works... but if I press a button or any
> > event that raise a postback, the dropdownlist that I fill gets empty!
> >
> > This also if I set its EnableViewstate property to false.
> >
> > Someone can help me?
> >
> > Thank you and regards
> > F.
> >
> >

Re: Using callback, I fill dorpdownlist without postback but it gets e

am 22.01.2008 14:46:42 von Fabio Mastria

Peter Bromberg [C# MVP] wrote:
> The reason why ViewState isn't working for you is that you are
> populating the dropdownlist in the browser with client script. Since
> there is no postback event from this, nothing gets stored in
> Viewstate. So in order to handle this you would need to repopulate
> your dropdown if there is a postback. The server - side code has no
> knowledge of the