datalist中可以自己布局的tooltip

來源:互聯網
上載者:User
代碼

 <style type="text/css">

        .tooltip 

        {

            display: none; 

            position: absolute; 

            z-index: 1001; 

            left: 10px;

            top: 15px;

            width: 170px;

            font-family: Trebuchet MS, Lucida Sans Unicode, Arial, Sans-Serif;

            font-size: 0.8em;

            padding: 3px; 

            border: dotted 1px;

            background-color: InfoBackground
            

        }

</style>

    <script type="text/javascript">

     function showPanel(divName) {

            var ctl = window.document.getElementById(divName);

            ctl.style.display = 'block';

            ctl.scrollIntoView();

     } 

     function hidePanel(divName) {

            var ct2 = window.document.getElementById(divName);

            ct2.style.display = 'none';

     }

    </script>

    <asp:DataList ID="DataList1" runat="server">
        <ItemTemplate>
            <tr>
                <td>
                </td>
            </tr>
            <td>
                <div>
                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("sub_plate_name") %>'></asp:Label>
                    <div style="display: inline; position: relative; z-index: 1000">
                        <img src="images/more.gif" alt="" onmouseover="showPanel('div<%# Eval("sub_plate_id") %>');"
                            onmouseout="hidePanel('div<%# Eval("sub_plate_id") %>');" style="z-index: 1000;" />
                        <div id="div<%# Eval("sub_plate_id") %>" class="tooltip">
                            <strong>id</strong>:<%# Eval("sub_plate_name")%><br />
                            <strong>說明</strong>:<%# Eval("sub_plate_description")%><br />
                        </div>
                    </div>
                    <%--    <%#Eval("plate_name") %>--%>
            </td>
            </tr>
        </ItemTemplate>
    </asp:DataList>

 

後台

代碼

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bind();
        }

    }
    public void bind()
    {
        string sql = "select * from mdsets_bbs_sub_plate";
        DataSet ds = OracleHelper.GetDS(sql);
        this.DataList1.DataSource = ds;
        this.DataList1.DataBind();
    }

  圖片用這個比較好

 

 

 

//GRIDVIEW TOOLTIP提示

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView drv = (DataRowView)e.Row.DataItem;
            for (int i = 1; i < e.Row.Cells.Count; i++)
                e.Row.Cells[i].ToolTip = drv["content"].ToString();
        }
    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.