Seems to be a trivial problem, but can’t pinpoint a solution.
I have a drop down bound to a datatable. I’m trying to insert a new item at position 0, but when the control is loaded, I don’t see the new listitem or any errors.
Public Sub Page_Load(ByVal sender As Object, ByVal e As eventargs) Handles Me.Load
If Not Page.IsPostBack Then
loadRegistrantAbstracts()
End If
End Sub
Public Sub loadRegistrantAbstracts()
Dim obj As New Lookups
Dim dtAbstracts As DataTable
dtAbstracts = obj.getAbstracts()
If dtAbstracts.Rows.Count > 0 Then
With ddlAbstracts
.DataSource = dtAbstracts
.DataTextField = "DisplayName"
.DataValueField = "AbstractID"
.DataBind()
.Items.Insert(0, New ListItem("Select Abstract..", "0"))
End With
End If
End Sub
The answer, thanks in part to HardCode, was the following: