473,414 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Refresh a ListBox in ASP.Net with C#

I want to create a .Net page with 2 controls. The 1st is a dropdown being
populated from a database. The 2nd control is a listbox which is also
populated from the same database but the content is dependent upon a
selection from the dropdown control. I have no DB issues but being new to
..Net want a slick way to refresh my listbox control without taking a round
trip to the server to requery my DB stored Proc each time I select a
different droplist item.
In classic ASP i have done this by using <div> tags, one for each subset of
data and making them dynamically visible or not depending on the dropdown
list selection but feel this is an overhead and there must be a better more
efficient way to handle this with client side script.

Any help greatly appreciated...
Nov 16 '05 #1
1 8579
Unless I am mistaken, the ASP.Net way is to move back to the server side, so
that your first control has AutoPostback set to true, at which point you
populate the second from within the first's selection changed event handler.

If there isn't much choice in the first dropdown, for example, then you
could "cache" all data from all possible instances on client side script,
then do this all client side. It sounds like your method already did this...

"Bish" <Bi**@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
I want to create a .Net page with 2 controls. The 1st is a dropdown being
populated from a database. The 2nd control is a listbox which is also
populated from the same database but the content is dependent upon a
selection from the dropdown control. I have no DB issues but being new to
.Net want a slick way to refresh my listbox control without taking a round
trip to the server to requery my DB stored Proc each time I select a
different droplist item.
In classic ASP i have done this by using <div> tags, one for each subset
of
data and making them dynamically visible or not depending on the dropdown
list selection but feel this is an overhead and there must be a better
more
efficient way to handle this with client side script.

Any help greatly appreciated...

Nov 16 '05 #2

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

Similar topics

5
by: Andrew Chanter | last post by:
I have a situation where I am using an unbound dialog form to update data in an Access 2002 split back end / front end scenario. The data update is done via an ADO call (direct to the back end...
3
by: Brian Basquille | last post by:
Hey there all, Fairly easy question for a C# expert, i assume! Am still working on my Photo Album. On frmBrowsePhotos, i have a listBox (photosList) containing photoID's from a table in an...
1
by: Tariq | last post by:
Hi, I have a list box that is bound to an arraylist, but when the data changes the listbox does not refresh. ----------------------------------------------------------------------------- al =...
2
by: Rosanne | last post by:
Hi All - I have a strange problem - I have an aspx page that contains server-side, multi-select listbox. The AutoPostBack property is set t false. The user should click on an item in the...
2
by: Arne Meissner | last post by:
Hello! Is there a function to update/refresh a listbox widget. My one is connected to a database and after a change of the database I would like the listbox to be updated. Thank you for your...
5
by: Randy | last post by:
I have button that deletes items from a SQL datatable. The items are displayed for the user in listbox, which is bound to the dataset. The code works just fine insofar as it deletes the correct...
5
by: rsteph | last post by:
I've got a list box that has about 6-7 columns with information, pulled from a table. When you click on a row in the list box it displays all the information in a series of text boxes, so that the...
7
by: Randy | last post by:
Hi, I've got a listbox on a form that gets updated by opening another form for data entry. Once the user enters the new item name and clicks "accept", the data entry form closes and the original...
5
by: BlackBox | last post by:
I have a Listbox1 in the main form and I can add listbox1 items in the parent form. But when I close the parent form Listbox1 in the main form does not get refresh. I need to re-open the app. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.