I have one database with three columns named id.name, mobile_no. I want to display mobile no as tooltip in dropdownlist items. Dropdownlist item showing name. Tooltip showing mobile number which is in database so fetch from database.
How it is?
I have one database with three columns named id.name, mobile_no. I want to display mobile no as tooltip in dropdownlist items. Dropdownlist item showing name. Tooltip showing mobile number which is in database so fetch from database.
How it is?
Since you talk about a dropdownlist, I'm assuming this is ASP.NET. Here's how:
Private Sub loadDropDown
Dim personDataTable As DataTable
Dim personDataRow As DataRow
Dim personListItem As ListItem
[Data access stuff to get data from DB goes here]
For Each personDataRow In personDataTable.Rows
personListItem = New ListItem
With personListItem
.Text = personDataRow.Item("Name").ToString
.Value = personDataRow.Item("Id").ToString
.Attributes.Add("title", personDataRow.Item("mobile_no").ToString)
End With
PeopleDropDownList.Items.Add(personListItem)
Next
End Sub