c# - timer not stopped in asp.net after timer disabled in asp.net -


i set timer in asp.net web page. disabled timer after completing process, timer still running.

static bool _end; protected void updatetimer_tick(object sender, eventargs e) {     if (_end)     {         _end = false;                              updatetimer.enabled = false;                             download();     } } 

this click event:

protected void btnstart_click(object sender, eventargs e) {                 stringbuilder threadbuilder = new stringbuilder();     progressbar1.visible = true;     preadytodown.visible = true;     _end = false;     progress progress = progressbar1.progress;      thread thread = new thread(() =>     {         _end= start(progress);         _builder = threadbuilder;     });     thread.start(); } 

this download file fun:

public void download() {     string path = server.mappath("~/") + "excelfiles\\sample.xlsx";     response.clearcontent();     //context.response.clearheaders();            response.bufferoutput = true;     response.charset = "";     response.addheader("content-disposition", "attachment;filename=exportdata1.xlsx");     response.contenttype = "application/vnd.xlsx";     response.writefile(path);     response.flush();     response.end();     return; } 

try one

     if(ispostback)                 { //first time timer1 has default value 60000 = 1 sec 2nd time value 10 min                     timer1.interval = 600000;                      viewstate["countet"] = 600000;                 } 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -