我想在鼠標懸停的工具提示中顯示一些數據。我在asp.net中使用datalist。如何在工具提示中顯示動態數據。數據將基於數據庫表。這是我的datalist的代碼,我希望在項目模板上顯示工具提示。工具提示數據將包含3個項目,即可用數量,現有數量和訂單數量。如何在asp.net C#中的datalist中的項目模板上顯示工具提示中的數據?
編輯:我試過在這個問題的答案提供的方式,但他們不工作。 有沒有什麼辦法可以使用JQuery和Web服務來做同樣的事情?如果是的話,請指引我正確的方式...
<asp:DataList ID="dlvProductSpecification" runat="server" RepeatColumns="10" HeaderStyle-Font-Size="16px"
Font-Size="Smaller" OnItemCommand="dlvProductSpecification_ItemCommand" OnItemCreated="dlvProductSpecification_ItemCreated"
OnItemDataBound="dlvProductSpecification_ItemDataBound">
<ItemStyle Font-Size="Smaller" />
<HeaderStyle HorizontalAlign="Center"> </HeaderStyle>
<HeaderTemplate>
<table class="header_dl">
<tr>
<td>
SPECIFICATION HEADER
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<%--<table style="text-align: center;">--%>
<table class="style_dl" onmouseover="showtooltip()" onmouseout="hidetooltip()">
<tr>
<td class="style_dl_td">
<asp:Label ID="lblReferenceNo" CssClass="labeltitle_dl" runat="server"><%# Eval("ReferenceNo")%></asp:Label>
<br />
<asp:Label ID="Label1" runat="server"><%# Eval("Specification")%></asp:Label>
<br />
<br />
<asp:HiddenField ID="hdnSpecificationID" runat="server" Value='<%# Eval("ProductSpecificationID")%>' />
<asp:HiddenField ID="hdnSpecification" runat="server" Value='<%# Eval("Specification")%>' />
<asp:HiddenField ID="hdnReferenceNo" runat="server" Value='<%# Eval("ReferenceNo")%>' />
<asp:HiddenField ID="hdnGTIN" runat="server" Value='<%# Eval("GTIN")%>' />
<asp:HiddenField ID="hdnAvailableQty" runat="server" Value='<%# Eval("AvailableQty")%>' />
<asp:Button ID="btnAddQty" runat="server" CommandName="GetData" Text="Add" /><br />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
我試過相同的,但仍然沒有工作.. –
在網格視圖,tootltip可以像這樣在RowDataBound事件增加。希望它可以幫助你。 if(e.RowType == DataControlRowType.Header) foreach(e.Row.Cells中的TableCell單元格) cell.Attributes.Add(「title」,「Tool tip。」); } } – user1509