Link to home
Start Free TrialLog in
Avatar of zintech
zintech

asked on

ASP.NET error with DropDownList

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">
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

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
ASKER CERTIFIED SOLUTION
Avatar of binaryevo
binaryevo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial