Solved

ASP.NET error with DropDownList

Posted on 2012-04-12
2
340 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
2 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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 500 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now