Bind the dropdown normally
ddlPlant2.DataSource = oDT
ddlPlant2.DataValueField = "plant"
ddlPlant2.DataTextField = "VendNamePlant"
ddlPlant2.DataBind()
Handle the ItemDataBound like this. All the fields in the data set are available in e.Item.DataItem
Protected Sub RadDropDownList1_ItemDataBound(sender As Object, e As DropDownListItemEventArgs) Handles ddlPlant2.ItemDataBound
Dim strError As String = ""
Try
Dim dataItem As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
Dim strVendorID As String = dataItem("VendorID").ToString()
e.Item.Attributes("VendorID") = strVendorID
Catch ex As Threading.ThreadAbortException
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, strError, App.AppName, App.UserName, False)
Me.lblError.Text = ex.Message
End Try
End Sub
Retrieve the values like this:
Private Sub ddlPlant2_SelectedIndexChanged(sender As Object, e As DropDownListEventArgs) Handles ddlPlant2.SelectedIndexChanged
Session("Plant") = ddlPlant2.SelectedValue
Dim item = ddlPlant2.SelectedItem
Dim strVendorID = item.Attributes("VendorID")
End Sub