AppendDataBoundItems

D

dglennon20

I'm getting the error: 'DropDownList6' has a SelectedValue which is
invalid because it does not exist in the list of items.
Parameter name: value

I'm using a formview. My EditItemView page has a dropdown that is not
in the InsertItemView. It must start out with a value that does not
exist in the datasource. I've read many posts and I still can't get it
to work.

<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:CubCorpCS %>"
SelectCommand="SELECT null as Username, '--Select--' as
EMail
Union All
SELECT Username, EMail FROM
VisionSEUserUsername ORDER BY Username">
</asp:SqlDataSource>

<asp:DropDownList ID="DropDownList6" runat="server"
DataSourceID="SqlDataSource3" DataTextField="Username"
DataValueField="Username" SelectedValue='<%# Bind("ModUser") %>'
AppendDataBoundItems="True">
<asp:ListItem Value="" Text="">Select Username</asp:ListItem>
</asp:DropDownList>

The insert page inserts the create user from a drop down just fine,
but the ModUser is a new dropdown on the edit page selecting existing
data. Seems pretty simple...

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top