1. Click on the button to start monitoring progress
var interval = Window.setinterval (globalcontrolprocess, the); 2.js Call General Handler polling progress function globalcontrolprocess () {$.post ("/common/computeprocess.ashx", {computetype:"Rsk_pro"},function (data) {data=json.parse (data); if(data.state.toString () = ="7") {setcompleted (); Window.clearinterval (interval); } Else{Setporgressbar (Math.ceil (parseint (data.state)/7* -)); $("#p"+data.state.tostring ()). FadeIn ("Slow"); } }); 3. Clear Timer Window.clearinterval (interval) after progress is completed;
4. General Handler CodeusingSystem;usingSystem.Collections;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Reflection;usingsystem.web;usingContract.domain;usingFramework;usingNpoi. Ss. formula.functions;usingWebapp.common;namespacehraweb.common{/// <summary> ///Summary description of Entityjsonlist/// </summary> Public classcomputeprocess:basepage, IHttpHandler, System.Web.SessionState.IRequiresSessionState { Public voidProcessRequest (HttpContext context) {context. Response.ContentType="Text/plain"; //context. Response.ContentType = "Application/json";context. Response.Cache.SetCacheability (Httpcacheability.nocache); if(Context. request["Computetype"]!=NULL&&!string. IsNullOrEmpty (context. request["Computetype"])) { stringComputetype = context. request["Computetype"]; if(Httpcontext.current.session[computetype] = =NULL) {HttpContext.Current.Session.Add (Computetype,1); } varobj =New{state =httpcontext.current.session[computetype.tostring ()]}; Context. Response.Write (Newtonsoft.Json.JsonConvert.SerializeObject (obj)); Context. Response.End (); } } Public BOOLisreusable {Get { return false; } } }}
Progress Reference Code