Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 9th, 2006, 07:05 PM
Registered User
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP.NET 1.1 dropdownlist problem

I used to dropdownlist control to allow users to select between different types of occupations. Depending on what they pick, they are to be assigned a different registration price.

However, some occupations require the same price.

So when I databind the control, I assigned the same value to more than one item in the control. Here is what the table in my database looks like:

faculty 2year 25
faculty 4year 25
undergrad 20
business 20
industry 15
government 15
highschool 10

Here is the problem:
The control will populate, however, upon postback, rather than remaining on the item the user selected, the control will display the first item with the same corresponding value. For example, if you selected business. Upon postback, the control will display undergrad.

How can I get around this identical value issue?

Hope someone can help. Thanks.

Old July 16th, 2006, 11:11 PM
Friend of Wrox
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts

Save the selectedvalue property someplace where it will be preserved across the postback. After the postback, retrieve the saved value to reset the selectedvalue property of the dropdown with the original selection is a small loop.

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 1.1 dropdownlist problem jjduran ASP.NET 2.0 Basics 0 July 9th, 2006 07:04 PM
Use Dropdownlist in DetailsView using asp.net/2.0 marvz ASP.NET 2.0 Basics 1 July 1st, 2006 01:43 AM
asp.net dropdownlist cena BOOK: Beginning ASP.NET 1.0 0 March 19th, 2006 01:21 AM
DropDownList in ASP.NET shurabhavesh ASP.NET 1.0 and 1.1 Basics 3 June 1st, 2005 09:25 AM
ASP.NET Dropdownlist pvasudevan ASP.NET 1.0 and 1.1 Professional 4 August 31st, 2004 11:21 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.