473,465 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dropdown lists

Hi-

I have created a dropdown list in my VB.net application, with data from
a database table - that works fine. I then added a record to a table
through a form that has this drop down list - that worked fine too. The
problem is now selecting and displaying this value. All the other
fields are displayed fine, but the drop down list comes out blank - any
idea as to what I am doing wrong?

Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #1
3 1253
- When you populate the ddlist the first time you are probably doing it in
the form_load event when not-is-post-back. You then display the form with the
DDList ok.
- When you use the DDList to select the item you want to select you are
either using an auto-post-back or you are selecting a
submit-button-of-some-kind. You are then posting to the server.
- In this case the aspx page is first loaded again (form_load() is run).
This is where you should be using the is-post-back part of code to get the
value of the DDList. At this point, if enable-viewstate is false on the
DDList, the page does not contain values to repopulate the DDList when it is
redispalyed.
-You can either enable-viewstate or repopulate the DDList yourself.
-If the post-back you are performing is the result of
add-this-new-record-to-the-DDList you will need to repopulate it anyway.
-You will also need to become familiar with the OnSelectedIndex_Change events.

(Please, don't take the names of the functions mentioned here literally. I'm
doing this off the top of my head.)


"Sara" wrote:
Hi-

I have created a dropdown list in my VB.net application, with data from
a database table - that works fine. I then added a record to a table
through a form that has this drop down list - that worked fine too. The
problem is now selecting and displaying this value. All the other
fields are displayed fine, but the drop down list comes out blank - any
idea as to what I am doing wrong?

Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 21 '05 #2
Hi Brad -

Thanks.

Here is what I am doing. Yes, I do all the steps you indicate. Then on a
if not ispostback I run a routine "Populate form" that runs a stored
procedure and selects a partcular record from the Database. Let's say
that the DDL was a list of students, then for this particular record I
have the student name in the record that was retrieved. I really don't
need to shoew the DDList again on the form as I don't want them changing
this value once entered anyway. But I cannot get the student name to
display at all. Typically a simple ddlname.selectedindex.text =
strstudentname
would have done it - but this time it will not work because the DDL was
created from a DB to begin with (my guess) - In the above scenario, how
can I populate that field on data retrieval? Thanks


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3

I got it to work folks - thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #4

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

Similar topics

4
by: Marc | last post by:
I've gotten everything up and running except for this -- I'd like to be able to have people have a dropdown list of cities in the US to use (or wherever) and not have to input them manually into a...
2
by: Ralph Freshour | last post by:
Is it possible to control the width of select dropdown lists? regardless of what text you type in? Thanks...
0
by: Mike O. | last post by:
MS Access 2003 "filter by form" has drop down lists that allow the user to select values for each field to filter by. However, once some values are selected,the remaining dropdown lists remain the...
0
by: Henke | last post by:
Hi, I have done some research about my problem I have when using the "back button" in IE to go back to a page with two dropdown lists. The both dropdown lists are populated with data. The...
2
by: Chris Becker | last post by:
This is my attempt to rephrase a question I asked earlier that got no response. I suspect it was my poor/unplanned wording. Here is another attempt: I have a form with some drop down lists. I...
1
by: Ed Chiu | last post by:
Hi, I have 2 dropdown lists on an ASP.Net page, the first is a list of states of US, the second is City list. When user selects a state, the web page does a postback, create a DB connection and...
1
by: cgian31 | last post by:
I have implemented a website where in a page are represented the data of one record, using cascade dropdown lists in 2 levels, within the same page/record. According to the selection in the...
2
by: Lair | last post by:
I am creating a page that has three to four databound dropdown lists. Each one is has different data sometimes from the same table but with a different where clause. What is the best way to...
1
by: eddie23 | last post by:
Hi group. we've an ASP.net application. there are dropdown lists all over it. we use IE6 SP2 here in work. When the dropdown is accessed by someone logged in as a local admin to the XP workstation...
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,...
1
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...
0
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,...
0
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...
0
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 ...

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.