DropDownList inside a DataList

S

snowburnt

I have a dropdownlist inside of a datalist.

this is what I've done to try to get data to it:

private void DisplayTicketData_ItemDataBound(object sender,
DataListItemEventArgs e){
DropDownList ddl;

ddl = (DropDownList)e.Item.FindControl("Owner");

ddl.Items.Add(new ListItem("happy","happy"));
ddl.Items.Add(new ListItem("1","happy2"));

}

the ASP:

<asp:DataList ID="DisplayTicketData"....>
...
<asp:DropDownList ID="Owner" />
...
</asp:DataList>

I tried more complicated databinding with this function, but if I
can't even get it to work with adding them like this, I figured there
was something wrong with my function.

all it gives me is a blank dropdown list.

Thanks in advance!

let me know if you need any more info.

--Bart
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top