Solved

ASP.NET error with DropDownList

Posted on 2012-04-12
2
342 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 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 500 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HttpPostedFile 1 26
Question about JQuery and asp.net 3 25
.NET 2008 VB and C# 6 27
tableview is not updating 1 8
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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