C#的UpdatePanel计时器的Page_Load [英] c# updatepanel with timer page_load
问题描述
我尝试用一些AJAX了。我有出现在我的母版,其中有一个更新面板和一个计时器自定义控件。计时器火灾和面板更新,一切都是花花公子。除了有一些操作,我不希望它在每次刷新时执行。这似乎是整个页面生命周期发生在每次刷新。存在变数我想设置,并保持其价值的刷新。有没有一种方法,使之只执行什么在timer_tick电话吗?
I'm experimenting with some AJAX now. I have a custom control which appears on my masterpage in which there is an update panel and a timer. The timer fires and the panel updates and everything is dandy. Except that there are some operations that I don't want it to perform on every refresh. It seems like the entire page lifecycle happens with each refresh. There are variables I want to set, and keep their value on the refresh. Is there a way to make it perform ONLY what's in the timer_tick call?
推荐答案
不知道什么是AJAX.Net后回看起来像,但我通常保护我的其他控件和内容检查后回来;
Not sure what what an AJAX.Net post back looks like to, But I usually protect my other controls and content by checking for post back;
protected void Page_Load(object sender, EventArgs e)
{
// if its a post back then my controls should already be setup...
if (!Page.IsPostBack)
{
InitControlData();
}
}
,然后将其应属于通到你的事件处理?
and then it should fall thru to your event handling?
protected void timer_tick(object sender, EventArgs e)
{
// Do my Ajaxy work~
}
这篇关于C#的UpdatePanel计时器的Page_Load的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!