日期:2014-05-18  浏览次数:20561 次

asp.net 点击某个链接页面不跳转,弹出一个层,取出动态数据
About_2.aspx 页面代码如下:


C# code
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="About_2.aspx.cs" Inherits="About_2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="clear">
    </div>
    <div class="tongzhi">
        <h4 style="padding-left: 5px; padding-top: 2px; color: Black;">
            发布任务正文</h4>
    </div>
    <asp:Repeater ID="source" runat="server" OnItemDataBound="bindSub">
        <ItemTemplate>
            <section>
            <h2 style="text-align:center;"><%#Eval("Title")%></h2>
            <div style="text-align:center;padding:0 0 10px 0;font-size:14px;">
                发布者:<%#Eval("Name") %>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                发布时间:<%#Eval("PublishTime","{0:yyyy-MM-dd  HH:mm}")%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                计划完成时间:<%#Eval("FinishTime","{0:yyyy-MM-dd  HH:mm}")%>
            </div>
            <asp:Repeater ID="sub" runat="server">
                <HeaderTemplate>
                        <div style="padding:10px 0 10px 0;font-size:14px;margin-left:40%;">接收人:<div style="margin-top:-48px;">
                </HeaderTemplate>
                <ItemTemplate>
                        <div style="float:left;margin:2em -2em 2em 5em;overflow:hidden;">
                                <asp:HiddenField runat="server" ID="receid" Value='<%#Eval("ReceId")%>' />
                                <a href="javascript:void(0);" onclick="show(<%#Eval("ReceId")%>)"><%#Eval("Name") %>&nbsp;</a>(&nbsp;<%#Eval("ReceStatus") %>&nbsp;)
                              
                       </div>
                </ItemTemplate>
                <FooterTemplate></div></div></FooterTemplate>
            </asp:Repeater>
            <div class="pager"><%#Eval("Content")%></div> 
            <div style="float:right;margin:10px 400px 0 0;">
                <a href="javascript:history.back()" ><< 返回</a> 
            </div>
        </section>
        </ItemTemplate>
    </asp:Repeater>
    <!-- 层 -->
    <div class="layout" style="display: none;">
        <div class="lhead">
            <a href="JavaScript:;" onclick="Lock_CheckForm(this);">[关闭]</a></div>
        <div style="padding: 8px;"> 
            <asp:Label runat="server" ID="content"></asp:Label></div>
    </div>
    <script type="text/javascript">
        function show(receid) {
            $(".layout").css("display", "block");
        }

        function Lock_CheckForm(theForm) {
            $(".layout").css("display", "none");
            return false;
        }
    </script>
</asp:Content>



其对应的About_2.aspx.cs文件中的方法如下: