【发布时间】:2016-09-14 15:36:03
【问题描述】:
在网站上(使用母版页),我以这种方式使用带有 UpdatePanel 的计时器:
<asp:Timer ID="Timer1" runat="server" Enabled="true" OnTick="Timer1_Tick" Interval="2"></asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:ListView ID="ListView1" runat="server" >
<ItemTemplate>
ici mes données
</ItemTemplate>
</asp:ListView>
<asp:Image ID="imgLoader" CssClass="img-loader" runat="server" ImageUrl="~/Images/Icones/loading.gif" Width="25px" />
</ContentTemplate>
</asp:UpdatePanel>
在我的代码后面:
protected void Timer1_Tick(object sender, EventArgs e)
{
ListView1.DataSource = Sql;
ListView1.DataBind();
Timer1.Enabled = false;
imgLoader.Visible = false;
}
我正在使用 Visual Studio 2012,因此我使用 iisexpress.exe: Managed (v4.0.30319) 测试了该站点,它运行良好 一旦我发布加载程序循环,我的网络服务器上的缺点是因为我有以下错误:
ScriptResource.axd?未捕获的 TypeError:n 不是构造函数
我的服务器是带有 IIS 8.5.9600 的 Windows 2012R2,我使用带有框架 v4 的应用程序池 我看到框架2可能有问题,必须修改文件AjaxTimer.js,但这是框架4,我在服务器上没有JS文件。 你有想法吗 ?提前感谢您的帮助!
【问题讨论】:
-
您对 ScriptResource.axd 进行了所有检查吗? blogs.msdn.microsoft.com/carloc/2008/12/04/…
-
谢谢你,但它不起作用。
标签: c# asp.net timer updatepanel