Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 September 24th, 2005, 12:57 PM
Registered User
 
Join Date: Sep 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to assign value in dropdown list

Hello,

I have a ddl that displays cities for the user to select.
ID City
1 Toronto
2 St. John's
3 Halifax

If the user selects St. John's (ID =2), the ID 2 gets wrote to the database for that user..this is fine, however when the user comes back to the page and changes some other data and NOT the city, St. John's gets ID=1 in the ddl, so when the user writes to the database again, the city changes to Toronto (ID=1)...

HOW DO I GET AROUND THIS. I am programming in VB.NET and using a Access database. i have also assign the value in dropdown list in page load event

Please any help is greatly appricated.

ankur

ankur bhargava
 
Old September 24th, 2005, 11:45 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Are you putting the binding code in an if not ispostback statement:?

if not ispostback then
   ddl.databind()
end if

 
Old September 25th, 2005, 12:20 PM
Registered User
 
Join Date: Sep 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ya i am checking the is postback in pageload event
the problem is actually the dropdown doesnt maintain its viewsate despite the viewstate prop is true

ankur bhargava
 
Old September 25th, 2005, 11:07 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Can you please post your code? Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown list maha .NET Framework 2.0 7 April 28th, 2007 12:32 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
HELP WITH DROPDOWN LIST enavas Excel VBA 1 April 6th, 2004 02:08 PM





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