代码如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NetSysMonitor3.aspx.cs" Inherits="NetSysMonitor3" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
     
    <title> </title>
    <script src="js/jquery-1.4.1.min.js" type="text/javascript"></script>
    <link href="style/Right.css" rel="stylesheet" type="text/css" />
     
    <script type="text/javascript">
        $(document).ready(function () {
            //动画速度
            var speed = 500;            //绑定事件处理
            $("#btnShow").click(function (event) {
                //取消事件冒泡
                event.stopPropagation();
                //设置弹出层位置
                var offset = $(event.target).offset();
                $("#divPop").css({ top: offset.top + $(event.target).height() + "px", left: offset.left });
                //切换弹出层的显示状态
                $("#divPop").toggle(speed);            });
        });
    </script>
</head>
<body onload="show()">
    <form id="form1" runat="server">
     
    <div class="content">
       
        <div class="right">
      
          
            <div class="rightBottom" style="overflow: scroll;">
                <asp:DataList ID="DataList1" runat="server" Height="205px" RepeatColumns="3" RepeatDirection="Horizontal"
                    Style="margin-right: 0px" Width="100%" OnItemCommand="DataList1_ItemCommand"
                    DataKeyField="WSID" OnItemDataBound="DataList1_ItemDataBound">
                    <HeaderTemplate>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <span style="font-size: 16px; font-weight: bold;">
                            <%#Eval("WSName")%></span><br />
                        <hr />
                        <span style="background-color: White;">楼&nbsp;&nbsp;&nbsp;层 : </span>
                        <%#Eval("FloorName")%><br />
                        <hr />
                        <span style="background-color: White;">所在IP地址 :</span>
                        <%#Eval("IPADDR")%>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:LinkButton ID="btnShow" runat="server" CommandName="select">查看详细</asp:LinkButton>
                        
                        <br />
                        <hr />
                        <!-- 弹出层 -->
                        <div id="divPop" style="background-color: #f0f0f0; border: solid 1px #000000; position: absolute;
                            display: none; width: 300px; height: 100px;">
                            <div id="Div1" style="text-align: center;" runat="server">
                                弹出层
                                <asp:GridView ID="GridView2" runat="server">
                                </asp:GridView>
                            </div>
                        </div> 
                        <%-- <asp:GridView ID="GridView2" runat="server">
                        </asp:GridView>--%>
                        <br />
                        <hr />
                    </ItemTemplate>
                    <FooterTemplate>
                    </FooterTemplate>
                </asp:DataList>
                      
            </div>
        </div>
        
    </div>
    </form>
</body>
</html>

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     
    <body>
    <input type="button" name="Submit" value="点击这里下面显示" onclick="qq.style.display='block'">
    <input type="button" name="Submit2" value="点击这里下面隐藏" onclick="qq.style.display='none'">
    <div id="qq">
    <table width="492" height="302"  border="0" cellpadding="1" cellspacing="1">
      <tr>
        <td width="488" bgcolor="#3366FF">内容,这个表格是嵌套在id是&quot;qq&quot;的DIV中的</td>
      </tr>
    </table>
    </div>
    </body>
    </html>
     
      

  2.   

    其实,你完全可以ajax读取啊
    http://dotnet.aspx.cc/article/d94323a7-e322-4ead-9f25-6e6629c8012e/read.aspx另外,你要知道,你的客户端不只是一个《div id=divPop>你可以打开浏览器源代码查看,id不是重复的,。你要搞清楚啊另外,你的点击是在服务器事件处理的吧?
      

  3.   

      $("#divPop")
    这样写是完全错误的 除非你的datalist只有一条数据
      

  4.   


    <asp:DataList ID="dl_action" runat="server" Font-Size="12px" Width="242px" DataKeyField="intDeviceId">
                                        <ItemTemplate>
                                               <div id="DIV" style="width: 83px; padding-right: 0px; float: right" runat="server">                                       <asp:Label ID="lbl_time" runat="server" Text="时间"></asp:Label>                                        </div>                       </ItemTemplate>                            </asp:DataList>
    隐藏层  后台DIV.style["display"]="none"