我想刷新主页的特殊部分而不是子页面 [英] i want refresh only particuler part of master page not child page
问题描述
< asp:ScriptManager ID =ScriptManager1runat =server>
< asp:Timer ID =TimerTimerunat =server Interval =1000>
< asp:UpdatePanel ID =UpdatePanel1runat =server>
< ; contenttemplate>
< asp:Label ID =lblDateTodayrunat =server>
< asp:Label ID =lblTimerunat =server >
< triggers> < asp:AsyncPostBackTrigger ControlID =TimerTime/>
这段代码在我身上主页
我的问题是当计时器刷新这个主页面部分时它也会刷新我的整个子页面
i只想刷新更新面板部分主页面
帮助我先生
谢谢。
我认为你没有关闭你的UpdatePanel。这可能是原因。
参考这些链接:
UpdatePanel控件简介 [ ^ ]
ajax-updapanel-control-with-triggers.html [ ^ ]
您的代码丢失<触发器>和< ContentTemplate>标签。我在masterpage上写了下面的代码,它运行得很好。
< ; 表格 runat < span class =code-keyword> = server >
< asp: script manager id = MasterScriptManager runat = server < span class =code-keyword>>
< / asp: script manager >
< asp :updatepanel id = UpdatePanel1 runat = server xmlns:asp = #unknown >
< 触发器 >
<asp:asyncpostbacktrigger controlid = TimerTime eventname = 勾选 / >
< /触发器 >
< ; contenttemplate >
< asp:label id = lblDateToday runat = 服务器 / >
< asp:label id = lblTime runat = server / >
< asp:timer id = TimerTime runat = server interval = 2000 ontick = 勾选 >
< / asp:timer >
< span class =code-keyword>< / contenttemplate >
< / asp:upda tepanel >
< / form >代码背后:
< span class =code-keyword> protected void Tick( object sender,EventArgs e )
{
// 代码实现。
}
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:Timer ID="TimerTime" runat="server" Interval="1000">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<asp:Label ID="lblDateToday" runat="server">
<asp:Label ID="lblTime" runat="server">
<triggers> <asp:AsyncPostBackTrigger ControlID="TimerTime" />
this code is on my master page
my problem is when timer refresh this master page part it will also refresh my whole child page
i want refresh only update panel part of master page
help me sir
Thank You.
I think you're not closing your UpdatePanel. That can probably be the cause.
Refer these links:
Introduction to the UpdatePanel Control[^]
ajax-updapanel-control-with-triggers.html[^]
Your code is missing <Triggers> and <ContentTemplate> tags. I wrote the following code on masterpage, and it is working just fine.
<form runat="server"> <asp:scriptmanager id="MasterScriptManager" runat="server" > </asp:scriptmanager> <asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown"> <triggers> <asp:asyncpostbacktrigger controlid="TimerTime" eventname="Tick" /> </triggers> <contenttemplate> <asp:label id="lblDateToday" runat="server" /> <asp:label id="lblTime" runat="server" /> <asp:timer id="TimerTime" runat="server" interval="2000" ontick="Tick"> </asp:timer> </contenttemplate> </asp:updatepanel> </form>Code behind:
protected void Tick(object sender, EventArgs e) { //Code implementation. }
这篇关于我想刷新主页的特殊部分而不是子页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!