2010-03-09 84 views

回答

2

在标准的工具提示否,但你必须编写自己的工具提示类来完成这一点。

1

如果您使用的是jQuery,您可以使用QTip Plugin 来做到这一点。

1

我在很多应用程序中使用QTip,但我不确定这是最好的解决方案.....如果这是您使用它的所有内容,那么这会带来很多开销,而且这非常简单从头开始。我将它视为一个简单的Jquery切换选项卡窗格,使用$(element).show()使其显示。

这里是沿着这些线路一啧啧:http://spyrestudios.com/how-to-create-a-sexy-vertical-sliding-panel-using-jquery-and-css3/

顺便说一句,虽然我知道.NET有一些GridView的获得,我爱上了那个datatables提供额外的功能。无论如何,这是我的客户引用的为他们的应用程序增加真正价值的一个JQuery插件。

0

您可以使用ModalPopup实现它并使用JavaScript动态显示它。 请尝试以下示例:

<script type="text/javascript"> 

    function getTop(e) 
    { 
     var offset=e.offsetTop; 
     if(e.offsetParent!=null) offset+=getTop(e.offsetParent); 
     return offset; 
    } 
    function getLeft(e) 
    { 
     var offset=e.offsetLeft; 
     if(e.offsetParent!=null) offset+=getLeft(e.offsetParent); 
     return offset; 
    } 
    function hideModalPopupViaClient() 
    { 
     var modalPopupBehavior = $find('ModalPopupExtender'); 
     modalPopupBehavior.hide(); 
    } 
    function showModalPopupViaClient(control,id) { 


     $get("inputBox").innerText="You choose the item "+control.innerHTML; 

     var modalPopupBehavior = $find('ModalPopupExtender'); 
     modalPopupBehavior.show();   
     $get(modalPopupBehavior._PopupControlID).style.left=getLeft($get('<%=DataList1.ClientID %>'))+ $get('<%=DataList1.ClientID %>').offsetWidth+"px"; 
     $get(modalPopupBehavior._PopupControlID).style.top=getTop(control)+"px";    

    } 

<body> 
<form id="form1" runat="server"> 

<ajaxToolkit:ToolkitScriptManager runat="Server" ID="ScriptManager1" /> 
<input id="Hidden1" runat="server" type="hidden" /> 
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
<ContentTemplate>  
    <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" > 
    <ItemTemplate>  
     <div style="border-color:Black;border-width:1px;border-style:solid;"> 
      <asp:Label ID="Label1" Text='<%# Eval("CategoryID") %>' runat="server"></asp:Label> 
      <asp:HyperLink ID="detail" runat="server" onmouseout="hideModalPopupViaClient()" onmouseover="showModalPopupViaClient(this)">'<%# Eval("CategoryID") %>'</asp:HyperLink> 
     </div> 
    </ItemTemplate> 
    </asp:DataList>   
    </ContentTemplate> 
</asp:UpdatePanel> 


<asp:SqlDataSource ID="SqlDataSource1" runat="server"   ConnectionString="<%$ ConnectionStrings:ConnectionString %>"   SelectCommand="SELECT * FROM [Categories]"></asp:SqlDataSource> 
    <asp:Button runat="server" ID="showModalPopupClientButton" style="display:none"/> 

    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server"    TargetControlID="showModalPopupClientButton" 
     PopupControlID="programmaticPopup"    RepositionMode="None" 
     /> 
    <br /> 

    <div CssClass="modalPopup" id="programmaticPopup" style="background-color:#EEEEEE;  filter:alpha(opacity=70);opacity:0.7;display:none;width:50px;padding:10px"> 
     <span id="inputBox" ></span> 


     <br /> 
    </div> 

</form> 

1

我使用VS2010和VS 2012的智能感知被显示在设计页面提示选项。

0

是的,你可以在ASP.net网格视图中获得工具提示。请参阅GridView1_RowDataBound事件中应包含的以下代码:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { 
    if (e.Row.RowType == DataControlRowType.Header) { 
     for (int i = 0; i < GridView1.Columns.Count; i++) { 
      e.Row.Cells[i].ToolTip = GridView1.Columns[i].HeaderText; 
     } 
    } 
}