[英]Is It possible to show tooltip on dropdown in asp.net
In my web application, i have dropdowncheckboxes control but i am trying to show tooltip on selectbox items. 在我的Web应用程序中,我具有dropdowncheckboxes控件,但是我试图在selectbox项上显示工具提示。 Is is possible to do. 是可能的。
I am tried code: 我尝试过的代码:
.aspx: .aspx:
<%@ Register Namespace="Saplin.Controls" Assembly="DropDownCheckBoxes" TagPrefix="asp" %>
<link rel="stylesheet" href="css/bootstrap-3.1.1.min.css" type="text/css" />
<link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
script tag
<script>
$(function () {
$("#tooltip1").tooltip();
});
</script>
<div class="tooltip1"> <asp:DropDownCheckBoxes ID="dropdown1" runat="server" UseSelectAllNode="true" UseButtons="true" OnSelectedIndexChanged="dropdown1_SelectedIndexChanged"
AutoPostBack="true"> <Style SelectBoxWidth="200" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" />
<Texts SelectBoxCaption="" />
</asp:DropDownCheckBoxes> <asp:Label runat="server" ID="tooltip1"></asp:Label>
.CS: .CS:
protected void Page_Load(object sender, EventArgs e)
{
tooltip1.Text = dropdown1.Texts.SelectBoxCaption;
}
protected void dropdown1_SelectedIndexChanged(object sender, EventArgs e)
{
List<String> checkedList = new List<string>();
foreach (ListItem item in dropdown1.Items)
{
if (item.Selected)
{
checkedList.Add(item.Value);
}
}
dropdown1.Texts.SelectBoxCaption = String.Join(",", checkedList.ToArray());
}
tooltip is not displayed can anyone tell me where i did mistake i don't know. 工具提示未显示,任何人都可以告诉我我不知道在哪里做错了。 Is there any events to display tooltip 是否有任何事件显示工具提示
image description here 图片说明在这里
Thank you 谢谢
Following method is working for adding tooltip for lists 以下方法正在为列表添加工具提示
public static void BindTooltip(ListControl lc)
{
for (int i = 0; i < lc.Items.Count; i++)
{
lc.Items[i].Attributes.Add("title", lc.Items[i].Text);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.