如何使用updatepanel更新“slave”内容页面?

时间:2013-11-25 07:39:02

标签: asp.net updatepanel master-pages scriptmanager

我正在使用母版页创建一个asp网站。我在内容页面中有一些链接。我想使用updatepanel浏览它们,使主页内容保持不变。我如何实现这一目标?

母版页

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="TestJquery.Site1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            this is master
        <% Response.Write(DateTime.Now); %>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                    </asp:ContentPlaceHolder>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>

Default.aspx的

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="TestJquery._default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    This is slave
    <asp:HyperLink NavigateUrl="default2.aspx" runat="server">default.aspx</asp:HyperLink>
</asp:Content>

Default1.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="default2.aspx.cs" Inherits="TestJquery.default2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    this is slave
    <asp:HyperLink NavigateUrl="default.aspx" runat="server">default</asp:HyperLink>
</asp:Content>

0 个答案:

没有答案