protected void SubmitButtonClicked(object sender, EventArgs e)
{
System.Timers.Timer timer = new System.Timers.Timer();
---
---
//line 1
get_datasource();
String message = "submitted.";
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "popupAlert", "popupAlert(' " + message + " ');", true);
timer.Interval = 30000;
timer.Elapsed += new ElapsedEventHandler(timer_tick);
// Only raise the event the first time Interval elapses.
timer.AutoReset = false;
timer.Enabled = true;
}
protected void timer_tick(object sender, EventArgs e)
{
//line 2
get_datasource();
GridView2.DataBind();
}
포스트 백 이벤트가 발생하지만 타이머 이벤트 핸들러가 timer_tick 이벤트를 호출 할 때 get_datasource 함수가 호출되지만 업데이트 된 데이터는 그리드보기에 표시되지 않습니다. timer_tick이 포스트 백 이벤트가 아니기 때문에 업데이트되지 않습니다.ASP.NET 타이머 이벤트
휴, 즉 혼란 찾고 메시지입니다 - 씨 Ratnajyothi를 수 당신이 다시 그것을 읽을 수 있도록 포맷? 또한 ASP.NET 응용 프로그램에서 '타이머'를 사용하여 서버에서만 실행되는 포스트 백을 발생시킬 수 없습니다. JavaScript 클라이언트 스크립트를 대신 사용하는 것이 좋습니다. –