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 March 14th, 2008, 12:33 PM
Registered User
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Bushwhacker
Default Gridview bound dropdownlist edititemtemplate

I have several gridviews where I've tried to implement a dropdown list filled with values from other tables in my database. The dropdown list is in the EditItemTemplate of the gridview. When I add the dropdownlist via the designer the dropdownlist works as expected. However, at some point I've yet to determine all dropdown list stop functioning as expected. When I hit the edit button I get the following error:

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

I've double and triple checked the values and as I stated previously it works for a while but ultimatly stops working.

Below is an example of how I set up all the dropdownlists:

<EditItemTemplate>
<asp:DropDownList ID="BorConsultDDL" runat="server" DataSourceID="ConsultantSQLDS" AutoPostBack="true" DataTextField="Name" DataValueField="Name" AppendDataBoundItems="true" SelectedValue='<%# Bind("BorConsult") %>'>
<asp:ListItem Value="Select Value" Text="--(Select Value)--"></asp:ListItem>
</asp:DropDownList><asp:SqlDataSource ID="ConsultantSQLDS" runat="server" ConnectionString="<%$ ConnectionStrings:APARConnectionString %>"
SelectCommand="SELECT [Name] FROM [lutConsultant]">
</asp:SqlDataSource>
</EditItemTemplate>

I've searched all over the internet looking for someone who has experienced and resolved this problem with no avail. Hopefully, someone can point out the err of my ways.
 
Old March 15th, 2008, 07:35 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

I appreciate this is an awful question, but when does it stop working? I'm not familiar with the error and "it works for a while but ultimatly stops working." leaves open large numbers of issues. It could be a control problem, database problem, settings problem, etc. We need to narrow it down. If it stops working something has changed, hopefully something you touched because then we can fix it. Did you upload new pages. Make changes to the DB?

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic List bound to GridView klavastrius ASP.NET 2.0 Basics 0 April 21st, 2008 12:05 PM
Sorting Gridview bound to strongly typed object kulkarnimonica ASP.NET 2.0 Professional 10 September 20th, 2007 03:32 PM
problem with dropdownlist in editItemTemplate hertendreef ASP.NET 2.0 Professional 4 July 31st, 2007 05:56 PM
Gridview - EditItemTemplate DropDownList issue Break40 ASP.NET 2.0 Basics 0 June 21st, 2006 08:43 AM





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