I have a RadDropDownList that I bind to a List of State objects. The DataTextField is set to the state abbreviation property, and the DataValueField is set to a Guid identifier. I want to set the tooltip of the list items to the state name, IE. AK = Alaska. I have tried a few different ways to do this, but none are working. In each case I have stepped through the code to verify that each item gets the proper value assigned to it. In the browser though there are no tool tips.
Method 1: After calling DataBind() I iterate through each item in the RadDropDownList and assign the state name to the item's ToolTip property.
Method 2: Is the same as method 1 except I do all the work inside the DataBound event.
Method 3: Thinking the issue was something to do with the data binding I iterate the state object list and create new a DropDownListItem for each object. I then assign the tooltip to the new DropDownListItem and add it to the RadDropDownList.Items collection.
Method 1: After calling DataBind() I iterate through each item in the RadDropDownList and assign the state name to the item's ToolTip property.
List<
State
> stateList = GetStates();
uxState.DataSource = stateList;
uxState.DataBind();
foreach (DropDownListItem item in uxState.Items)
{
State state = stateList.Find(delegate(State myState)
{
return myState.StateId == new Guid(item.Value);
});
if (state != null)
{
item.ToolTip = state.Name;
}
}
Method 2: Is the same as method 1 except I do all the work inside the DataBound event.
Method 3: Thinking the issue was something to do with the data binding I iterate the state object list and create new a DropDownListItem for each object. I then assign the tooltip to the new DropDownListItem and add it to the RadDropDownList.Items collection.
foreach (State state in List<
State
>)
{
DropDownListItem item = new DropDownListItem(state.Abbreviation, state.StateId.ToString());
item.ToolTip = state.Name;
uxState.Items.Add(item);
}