![]() |
Using callback, I fill dorpdownlist without postback but it gets empty when a postback is executed
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
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
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 <option ..> elements that you've put into the control client - side. -- Peter Site: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com MetaFinder: http://www.blogmetafinder.com "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 ge
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
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 <option ..> elements that you've put into the > control client - side. -- Peter OK Peter it is clear... but how I can recover the data used to fill the dropdownlist in the previous roundtrip? I someone want, I can send via mail the entire project (visual studio 2005). I fail continuously don't know what to do... in the callback functions, If i fill the dropdownlist or not, it's the same, because callback doesn't affect the viewstating process. help :/ thank you |
Use a hidden textbox to store selected value of the dropdown. U need to store using client script.
When postback happens generate the dropdown in the backend and then select the value using the hidden textbox value. |
| All times are GMT. The time now is 07:05 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.