Connecting Tech Pros Worldwide Help | Site Map

why does the ASP dropdownlist not work when binding?

Newbie
 
Join Date: Oct 2009
Posts: 2
#1: Oct 9 '09
I have placed a dropdown list in the edititemtemplate of a formview control and followed specific MSDN instructions on how to bind the list source to a separate SQL lookup data source but have the formview bound to the main data source. If I set the selecteditem value to bind to the formview control I always get the following error:
'DropDownList2' has a SelectedValue which is invalid because it does not exist in the list of items.

This is my asp:
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource2" DataTextField="Type"
DataValueField="Type"
selectedvalue='<%# Bind("ServiceProviderType") %>'>
</asp:DropDownList>
I have read over 50 posts on this and got nowhere - HELP!
CroCrew's Avatar
Expert
 
Join Date: Jan 2008
Location: Michigan
Posts: 338
#2: Oct 9 '09

re: why does the ASP dropdownlist not work when binding?


Hello garyhumf7,

From my understanding this is a "Classic" ASP forum. Your question should be posted in the ".NET" section.

Sorry,
CroCrew~
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#3: Oct 9 '09

re: why does the ASP dropdownlist not work when binding?


Quote:

Originally Posted by CroCrew View Post

Hello garyhumf7,

From my understanding this is a "Classic" ASP forum. Your question should be posted in the ".NET" section.

Sorry,
CroCrew~

You are correct, this definitely is a "ASP.NET" question, and doesn't belong in the "classic ASP" forum.

I have moved it over for you.

Jared
Newbie
 
Join Date: Oct 2009
Posts: 2
#4: Oct 11 '09

re: why does the ASP dropdownlist not work when binding?


Thanks - please bear with the newbie.
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#5: 1 Week Ago

re: why does the ASP dropdownlist not work when binding?


Is there a "ServiceProviderType" in your data source?

-Frinny
Reply

Tags
databind, dropdownlist