By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 946 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

ASP.NET, Listboxes, Javascript and the Viewstate

P: n/a

have a problem and I'm not sure how to handle/fix it.

I have three listboxes on my page. The first listbox has a list of software
products. When you select an item in the Products listbox, then the two
other listboxes fill up with choices, one has related versions of that
product, and the other has related Categories. Pretty typical stuff.

Anyway, when I first designed the page, I used ASP.NET code to fill the
values of the Version and Category listboxes whenever the Product listbox
was clicked I had the AutoPostback of the Products listbox set to true), and
this worked and submitted just fine. When I submitted the page, all the
versions and categories were properly submitted. (I should also mention that
all three of the listboxes are MULTI select, and will almost always have
mutiple items selected the way we use them).

But this caused a lot of postbacks, and thus a lot of server round-trips,
which is wasteful and annoying. So I wrote some javascript code to handle
loading the version and category listboxes. This works great, and no post
backs. But when I go to submit the page, not all the selected items show up.
Only the items that were displayed when the page initially loaded get
submitted, otherwise, they don't seem to exist.

I assume this has something to do with Viewstate. I guess that the viewstate
is being queried as to what fields exist in the listboxes, as opposed to
looking at the actual form data.

Is there a way around this? I can always go back to the original model, but
I'd like to keep the javascript functionality if possible.
--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.