计时器的UpdatePanel [英] Timer in UpdatePanel

查看:301
本文介绍了计时器的UpdatePanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp:UpdatePanel中有一个asp:定时器。这些都是在主/内容页。在code是如下:

I have an asp:UpdatePanel with an asp:Timer. These are in a Master/Content Page. The code is below:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick"></asp:Timer>
    </ContentTemplate>
</asp:UpdatePanel>

但是,当计时器触发时,我得到如下因素的错误:

But when the timer fires, I get the folowing error:

微软JScript运行时错误:Sys.WebForms.PageRequestManagerParserErrorException:从服务器收到的消息无法解析。此错误的常见的原因是当响应由呼叫修改为回复于(),响应滤波器,的HttpModules或服务器跟踪被使能。
详细信息:错误解析附近

这工作在一个独立的网络形式,但不是在内容页与母版页。

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near '

This works in a standalone web form, but not in a content page with a master page.

谁能解释一个修复此?

在此先感谢您的帮助!

推荐答案

有没有为什么你在的UpdatePanel的定时控制specifc原因

Is there a specifc reason why you have the Timer control in the UpdatePanel?

每天我都需要使用一个定时控件导致的UpdatePanel 刷新,我已经将它设置时间像下面的,它工作正常与 MasterPages

Every time I have needed to use a Timer control to cause an UpdatePanel refresh, I have set it up like the following and it works fine with MasterPages:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> 
    <Triggers>
        <asp:AsyncPostBackTrigger  ControlID="Timer1" EventName="Tick" />
    </Triggers>
    <ContentTemplate> 
        <!-- your content here, no timer -->
    </ContentTemplate> 
</asp:UpdatePanel> 

<asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick">
</asp:Timer> 

使用触发引起的UpdatePanel 勾选刷新事件。你只需要嵌入内容的的UpdatePanel 如果可能的话。

Use the Trigger to cause the UpdatePanel to refresh from the Tick event. You only want to embed content in your UpdatePanel if possible.

这篇关于计时器的UpdatePanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆