Help with Dropdownlist Can't add List Items

  • Thread starter Thread starter Jack
  • Start date Start date
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
 
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

Back
Top