我有這個問題相同的問題。 se the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation我還沒有與<%@ Page EnableEventValidation="false" %>
。我任何問題,解決它,我嘗試無法解決Timer_Tick
protected void Timer1_Tick(object sender, EventArgs e)
{
Label2.Text = Convert.ToString((Convert.ToInt32(Label2.Text) - 1));
if (Convert.ToInt32(Label2.Text) == 0)
{
Timer1.Dispose();
Submit();
}
}
代碼做工精細意味着submit()
是工作,如果我從調用提交button.If其呼叫從Timer_Tick
它不是work.And計時器沒有停止或處置。什麼是PLZ建議的問題?
定時器:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick">
</asp:Timer>
<asp:Label ID="Label1" runat="server" Text="Remaining Time:(Min)"></asp:Label>
<asp:Label ID="Label2" runat="server" Text="100"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
您可以在初始化定時器的位置顯示代碼嗎?我懷疑你有一些不太正確的東西。是否拋出任何異常?它是否激發過Timer_Tick方法? – 2012-01-05 17:04:28
也在代碼中的位置是Timer1聲明它是什麼訪問級別.. – MethodMan 2012-01-05 17:05:21