Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.NET error with DropDownList

Posted on 2012-04-12
2
Medium Priority
?
348 Views
Last Modified: 2012-06-27
I get the following error:

Parser Error

Parser Error Message: System.Web.UI.WebControls.ListItemCollection must have items of type 'System.Web.UI.WebControls.ListItem'. 'asp:DropDownList' is of type 'System.Web.UI.WebControls.DropDownList'.

The error comes from the following code:

<asp:DropDownList ID="GenericTypeBox" runat="server"
                                    DataSourceID="GenericLaborDataSource" DataTextField="code_value_desc"
                                    DataValueField="code_value" Visible="False">
0
Comment
Question by:zintech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37839397
The Problem is with your GenericLaborDataSource . . . you have the wrong type.

Change it from a ListItemCollection to a SqlDataSource.



See this:

http://stackoverflow.com/questions/805162/asp-net-drop-down-list-and-data-source-created-dynamically
0
 
LVL 14

Accepted Solution

by:
binaryevo earned 2000 total points
ID: 37839406
From the code you posted, at first glance, it doesnt appear that the <asp:DropDownList tags are being closed correctly with either />  or </asp:DropDownList>
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question