473,756 Members | 3,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET, Listboxes, Javascript and the Viewstate


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
0 1584

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2562
by: nadia | last post by:
I am have used php to create a two sets of arrays of listboxes, each of the listbox in the array have a unique ID. One of the list boxes are dependant on the other one. I have written the code in javascript, well changed existing code. I need to be able to select the element by ID rather than name. The code was working before I changed things to "getElementByID". I am not very good at javascript so I am not sure if I am on the right track,...
3
1710
by: Simon Templar | last post by:
I need the following functionality: With 2 listboxes populated from a database with the SAME data, I need any of the listboxes to stop displaying the option when selected at the other listbox. Eg: data records are A and B, and initially are available in both listboxes, but once the user selects A in the first listbox, the second one should only display B. Any reference?
4
1915
by: bill yeager | last post by:
I have several template columns inside of a datagrid. Inside of these template columns are databound listboxes: <asp:TemplateColumn HeaderText="Crew Chiefs"> <ItemTemplate> <asp:listbox AutoPostBack="False" BackColor="#ffffff" id="lstCrewChief" runat="server" Rows="1" DataSource="<%# DsCrewChief1 %>" Enabled="True"
5
19725
by: Ken Varn | last post by:
Is it possible to interact with the ASP.NET ViewState using JavaScript? I would like to be able to access data in ViewState through JavaScript and also set ViewState data. Not sure if this is the "best:" way to send data between ASP.NET pages and JavaScript. If anyone has other suggestions, please feel free to comment. -- ----------------------------------- Ken Varn Senior Software Engineer
0
1101
by: Terry D | last post by:
I'm having an issue with an ASP.NET page (VS.NET 2003, VB.NET, Oracle back end). The page uses the standard VS.NET grid to display the records from a particular table. The user can edit certain fields in the grid. There are 10 columns in the grid, 5 static fields (labels), 4 listboxes, and 1 edit box. 2 of the listboxes hold about 12 items each and the other 2 listboxes only contain 2 items. The problem is that on some lower end...
1
1348
by: Ryan Ternier | last post by:
I have two listboxes, and allow users to move items between them via the following function: function SwitchList(fbox, tbox){ var arrFbox = new Array(); var arrTbox = new Array(); var arrLookup = new Array(); var i; for (i = 0; i < tbox.options.length; i++) {
5
1321
by: DC Gringo | last post by:
I have an asp.net vb page with two web user controls on it. The first user control, uc1.ascx has a series of list boxes that are populated in series by each other with ONSELECTEDINDEXCHANGED. In the second control, uc2.ascx, lower down on the page, there is an imagebutton. When the imagebutton is clicked, it goes to the same page with a change in url parameter pageID. The control mentioned above sticks around, while the second one is...
4
3516
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I click a button on a pop-up window the javascript for that button click does a 'button.form.submit'. On the Server side there is a Button click event for this button, but for some reason it no longer fires. It worked fine before and everything...
3
1694
by: Aussie Rules | last post by:
Hi. I am using Live Earth SDK, and have very little Javascript knowledge, but I need to insert values into a Javascript function, where the vales are in the ASP.net VB code. The javascript function is below, but I need to replace the value (47.6, -122.33) with variables in the code behind page that I get from my SQL 2000 database.
0
10046
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6542
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.