Hi,
I am binding a listbox using a SQLDatasource and then adding an item ("All") to the list on the item databound event. The problem is that it is adding it in the second position and I need it to be the first item in the list. Is there a way to add an item at a specific position?
Thanks for your help.
I am binding a listbox using a SQLDatasource and then adding an item ("All") to the list on the item databound event. The problem is that it is adding it in the second position and I need it to be the first item in the list. Is there a way to add an item at a specific position?
Thanks for your help.
Private Sub rlbCompanyName_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListBoxItemEventArgs) Handles rlbCompanyName.ItemDataBound
Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
e.Item.Attributes.Add("CompanyNumber", drv("CompanyNumber").ToString())
If Me.rlbCompanyName.FindItemByValue("All") Is Nothing Then
Dim item As New RadListBoxItem("All", "All")
item.Attributes.Add("CompanyNumber", "00")
Me.rlbCompanyName.Items.Add(item)
End If
If Not Me.rlbCompanyName.FindItemByText("Unknown") Is Nothing Then
Dim itemToRemove As RadListBoxItem = rlbCompanyName.FindItemByText("Unknown")
Me.rlbCompanyName.Items.Remove(itemToRemove)
End If
End Sub