Help with Dropdownlist Can't add List Items

J

Jack

Hello,

I have a dropdownlist in my aspx page:

<asp:DropDownList ID="DDLProjects" runat="server"><asp:ListItem Text
="TEST9" Value ="TEST9"/></asp:DropDownList>

Then in my Page_Load I have:

Dim newListItem1 As New System.Web.UI.WebControls.ListItem()
newListItem1.Text = "TEST2"
newListItem1.Value = "TEST2"
DDLProjects.Items.Add(newListItem1)
DDLProjects.Items.Add(New ListItem("Item 1", "1"))

DDLProjects.Items.Add(New ListItem("T1", "T2"))

The Only thing I can get in the drop down is the TEST9 witch is done the the
ASPX page and not in the Code.

Any Help would be great!!!

Thanks,

Jack
 
E

Eliyahu Goldin

The code looks fine. There must be an error somewhere else. Set a breakpoint
on this code and debug it.
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top