Assign attribute web control
I have dropdownlist with text to display and value as hidden value. I want keep changing value tooltip as value when user select other selection. Well, I am already try this code but not work properly:
<asp:Dro开发者_C百科pDownList ID="ddlBranch" runat="server" Width="350px" ToolTip='<% ddlBranch.Value %>'>
Display in firefox dropdownlist tooltip as <% ddlBranch.Value %>
Regard
Try this
for (int i = 0; i <= DropDownList1.Items.Count - 1; i++)
{
DropDownList1.Items[i].Attributes.Add("Title", DropDownList1.Items[i].Text);
}
精彩评论