Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 5th, 2008, 11:33 PM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Phantom Databinding on drop down list

I have converted a project from ASP.net 1.1 to 2.0 using Visual Studio 2008. I had not touched this code for two years and am having a ton of problems with it. The conversion was successful according to the wizard and it backed up the project in a "backup" folder.
On the front page I have two drop down lists. One called Projects and the other Branches, each is bound to a table in a database using Datareaders. When the "Projects" drop down is changed part of it's query pulls in a BranchID and is supposed to set the Branches drop down to that value.

However each time I change the Projects drop down I get an error that says that the value of the BranchID is outside the range:

dlstBranches has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value

Stack Trace
[ArgumentOutOfRangeException: 'dlstBranches' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value]
   System.Web.UI.WebControls.ListControl.set_Selected Value(String value) +1827626
   Urgent.PP_New.dlstProject_SelectedIndexChanged(Obj ect sender, EventArgs e) +1069
   System.Web.UI.WebControls.ListControl.OnSelectedIn dexChanged(EventArgs e) +105
   System.Web.UI.WebControls.DropDownList.RaisePostDa taChangedEvent() +134
   System.Web.UI.WebControls.DropDownList.System.Web. UI.IPostBackDataHandler.RaisePostDataChangedEvent( ) +7
   System.Web.UI.Page.RaiseChangedEvents() +117
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1646

So I checked the databinding code for the Branches drop down and I found that it is being declared somewhere besides the PageLoad event. And thus the values are wrong. I even commented out the binding code in the PageLoad and still the Branches drop down was populated when I ran the page.

Is there something I'm missing? I checked the "designer.vb" file and I didn't see any binding code in there. Where else would it be looking? I am at a loss.

I tried putting a SQLDataSource on the page and binding the Branches drop down to that but it came back with the error that the Datasource and DataSourceID propterties were both being set and that I should only set one.

Thanks for any help you can give.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Usercontrol dropdown list databinding forkhead ASP.NET 1.0 and 1.1 Professional 14 February 12th, 2008 01:01 AM
Drop down list carumuga Classic ASP Basics 1 February 6th, 2007 01:37 PM
drop down list values based on another drop down noor ASP.NET 1.0 and 1.1 Basics 3 July 5th, 2005 09:57 AM
Drop Down List mrideout BOOK: Beginning ASP.NET 1.0 6 March 18th, 2005 02:32 AM
Drop Down List mrideout BOOK: Beginning ASP.NET 1.0 8 September 16th, 2004 07:11 AM



All times are GMT -4. The time now is 02:41 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.