I want to add items (text/value pair) to a dropdownlist. How come I only get items which are all the same (all items have the same text/value as the last item that is being added)?
My code:
Dim ddlItem As New ListItem
ddlItem.Text = "April 2005"
ddlItem.Value = "April"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Mei 2005"
ddlItem.Value = "May"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Juni 2005"
ddlItem.Value = "June"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Juli 2005"
ddlItem.Value = "July"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Augustus 2005"
ddlItem.Value = "August"
ddlMonthYear.Items.Add(ddlItem)
My code:
Dim ddlItem As New ListItem
ddlItem.Text = "April 2005"
ddlItem.Value = "April"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Mei 2005"
ddlItem.Value = "May"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Juni 2005"
ddlItem.Value = "June"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Juli 2005"
ddlItem.Value = "July"
ddlMonthYear.Items.Add(ddlItem)
ddlItem.Text = "Augustus 2005"
ddlItem.Value = "August"
ddlMonthYear.Items.Add(ddlItem)