ASP How to use dropdown list with objectdatasource

Joined
Aug 10, 2010
Messages
1
Reaction score
0
It must be new a newbe, freshmens error:
Please help, I will try to keep the question short:

1. I am new to ASP and I can not get this to work:

2. I am Using a
<asp:DropDownList in a <InsertItemTemplate> in a <asp:ListView

3. The dropdownlist during insert does not get polulated (it is empty) while the same construction and same datasource works in the edittemplate:
<asp:DropDownList in a <EditTemplate> in a <asp:ListView

4. I noticed that filling the dropdownlist with a <asp:ListItem works; the insert list is populated. (not usable for me)

In both cases I use the same datasource from the code behind like this :
Edit:
<asp:DropDownList ID="DropDownStartday" runat="server" SelectedValue='<%# Bind("startday") %>'
DataSource="<%# GetDataSourceStartDay() %>" DataValueField="daynum" DataTextField="dayname"

Insert: (with or without Selectedvalue: NoJoy)
<asp:DropDownList ID="DropDownStartday" runat="server"
DataSource="<%# GetDataSourceStartDay() %>" DataValueField="daynum" DataTextField="dayname"

Why does the Drowdown contains data in the editmode and not in the insertmode?

Please help, Thanks
 
Last edited:

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,575
Members
45,053
Latest member
billing-software

Latest Threads

Top