如何避免母版刷新? [英] How to avoid master page refreshing?
问题描述
我有一个母版页和内容页面。在母版页面中,我有一些按钮,点击它们将b / b
带到相应的内容页面。每当我点击母版页中的按钮时,会发生什么,
整个母版页与内容页一起刷新。我想知道如何刷新这个母版页。当我搜索谷歌时,我想到了在主页面的头标记下使用两行,如'meta ..','meta ..'。这也没有帮助。即使我不使用更新面板它也不起作用。即使updatemode = conditional被删除它也不起作用。按钮(此处未显示)位于更新面板中。我提交了我的代码:
<%@ Master 语言 = C# AutoEventWireup = true CodeFile = MasterPage.master.cs 继承 = MasterPage %> ;
< !DOC TYPE html PUBLIC - // W3C // DTD < span class =code-attribute> XHTML 1.0 Transitional // EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >
< html xmlns = http:/ /www.w3.org/1999/xhtml\">
< head runat = 服务器 >
< title > 无标题Page < / title >
< meta http-equiv = Page-Enter content = blendTrans(Durati) on = 0) / >
< meta http -equiv = Page-Exit 内容 = blendTrans(持续时间= 0) / >
< asp:ContentPlaceHolder id = head runat = 服务器 >
< / asp:ContentPlaceHolder >
< / head >
< body >
< 表格 id = form1 runat = server >
< asp:ScriptManager ID = ScriptManager1 runat = server EnablePartialRendering = true >
< / asp:ScriptManager >
< asp:UpdatePanel ID = UpdatePanel133 runat = server UpdateMode = 条件 >
< ContentTemplate >
< span class =code-keyword>< div >
< asp:Panel ID = Panel1 runat = server 宽度 = 943 样式 = margin-左:285px; margin-top:2px; 高度 = 200 >
< table class = 样式 = margin-left:-1px; margin-top:-1px width = 178 >
< tr >
< td >
< asp:Image ID = Image3 runat = server < span class =code-attribute> DescriptionUrl = 〜/ good food logo.jpg
高度 = 200px ImageUrl = 〜/ good food logo.jpg 宽度 = 220px / >
< / td >
< / tr >
< / table >
你忘了把这个<在contenttemplate之前的
< triggers>
< asp:asyncpostbacktrigger controlid = 按钮名称 eventname = 点击事件 />
< / 触发器 > 跨度>
I have a master page and content pages. In master page I have some buttons which on click would
take to respective content page. What happens is whenever I click a button in master page, the
whole master page is refreshing alongwith the content page. I want to know how stop this master page refreshing. When I searched Google I got an idea of using two lines under head tag of master page like 'meta..', 'meta..'. This also not helping. Even if I dont use Update Panel it doesnt work. Even if updatemode=conditional is removed it doesnt work. The buttons (not shown here) are within Update Panel. I submit my code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!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 runat="server">
<title>Untitled Page</title>
<meta http-equiv ="Page-Enter" content ="blendTrans(Duration=0)"/>
<meta http-equiv="Page-Exit"content="blendTrans(Duration=0)"/>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" >
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel133" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div>
<asp:Panel ID="Panel1" runat="server" Width="943" Style=" margin-left:285px; margin-top:2px;" Height="200" >
<table class="" style=" margin-left:-1px; margin-top:-1px" width="178">
<tr>
<td>
<asp:Image ID="Image3" runat="server" DescriptionUrl="~/good food logo.jpg"
Height="200px" ImageUrl="~/good food logo.jpg" Width="220px" />
</td>
</tr>
</table>
you forgot to put this
before the contenttemplate
<triggers> <asp:asyncpostbacktrigger controlid="name of your button" eventname="the click event" /> </triggers>
这篇关于如何避免母版刷新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!