473,756 Members | 6,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listboxes

I'm using ASP.Net and SQL Server
I have 2 listboxes. I have a table with 50 states.
In one listbox I want to show the states that are associated with a record.
Let's say 4 states. I can do this.
AL
AK
AR
CA
In the other listbox I want to show whatever states are not in the first
listbox.
Lets say the other 46 states.
..........
How can I use the values of the first listbox to determine whats in the
second. I've tried code that uses the listitem etc... but can't quite get
it.

Thanks.

E
Nov 18 '05 #1
1 1068
well without basically searching the first listbox before appending it to
the second list box the only other way i could think is to filter the
records itself ?

not sure on the efficiency though... if ur using a datareader build a query
that filters out the states u already have using a sql NOT IN ( AL, AK ....)

or

if u got the list of items in a datatable in a dataset i suppose u could get
a dataview done by filtering the states from the first listbox..

Anybody else have a better way ?
"Big E" <no****@nospam. com> wrote in message
news:eT******** ******@TK2MSFTN GP10.phx.gbl...
I'm using ASP.Net and SQL Server
I have 2 listboxes. I have a table with 50 states.
In one listbox I want to show the states that are associated with a record. Let's say 4 states. I can do this.
AL
AK
AR
CA
In the other listbox I want to show whatever states are not in the first
listbox.
Lets say the other 46 states.
.........
How can I use the values of the first listbox to determine whats in the
second. I've tried code that uses the listitem etc... but can't quite get
it.

Thanks.

E

---
Outgoing mail is certified Virus Free. (well i'd like to think it is.. )
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.723 / Virus Database: 479 - Release Date: 19/07/2004
Nov 18 '05 #2

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

Similar topics

0
1412
by: Jeffrey Barish | last post by:
I have an application that produces two listboxes. I would like to be able to select one of the items in the first listbox and one of the items in the second listbox. However, when I make my selection in the second listbox, the selected item in the first listbox gets deselected. Is there a way to do this? I tried setting selectmode to MULTIPLE, but that option only allows me to select multiple items in one of the listboxes (both of...
3
459
by: softengine | last post by:
Can and how do you alter a data view to include a look up field from another data table? The data table of the dataview only has the key, the value I need is in another data table. Can and how to you reference the value of a column in a data table/view from the row filter string of a different data view. I'm using a strongly typed dataset. Below is more info.
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?
9
4951
by: Susan Bricker | last post by:
Hi. I have two questions ... (1) I want to use a Listbox to enable the user to select 1 or many items from the list. However, I'm having trouble figuring out how to find out t which items have been selected. How can I do that? Given the listindex, .selected, .itemsselected, .itemdata properties -- I'm getting confused. (2) I, actually, have two listboxes on the form and I want to ONLY let the user select items in one list. The...
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"
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++) {
0
1584
by: Luis Esteban Valencia | last post by:
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...
2
4351
by: salad | last post by:
This is a tip on how to speed up listboxes DRAMATICALLY. Persons that would benefit are those that are constantly updating the rowsource of a listbox/combobox in order to filter and sort the data and the refreshes are slow. (OT. I've often wondered why there is no .Sort or .Filter property for Combos and Listboxes.) My listboxes , and their rowsources, on my form were constantly being refreshed to filter and sort data. Ex:
0
862
by: amidala | last post by:
Hello, everyone, i've recently started using C# and i'm rather new to this language. I'm trying to make a small project now that is combining the basic knowledge of programming (according to me :) ). But of course i crashed a wall at a certain moment. Actually two walls. I checked a lot of webpages, forums, but couldn't find a solution. So, the problem is: I have two listboxes and two textboxes. The data, gathered in the listboxes is later on...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
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
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9713
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
6534
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
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
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
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.