Using System; Using System. Data; Using System. Configuration; Using System. Web; Using System. Web. Security; Using System. Web. UI; Using System. Web. UI. WebControls; Using System. Web. UI. WebControls. WebParts; Using System. Web. UI. HtmlControls; Using System. Threading; Using System. IO; Public partial class _ Default: System. Web. UI. Page { Private void beginProgress () { // Progress progressbar.htm display progress bar Interface String templateFileName = Path. Combine (Server. MapPath ("."), "ProgressBar.htm "); StreamReader reader = new StreamReader (@ templateFileName, System. Text. Encoding. GetEncoding ("GB2312 ")); String html = reader. ReadToEnd (); Reader. Close (); Response. Write (html ); Response. Flush (); } Private void setProgress (int percent) { String jsBlock = "<script> SetPorgressBar ('" + percent. ToString () + "'); </script> "; Response. Write (jsBlock ); Response. Flush (); } Private void finishProgress () { String jsBlock = "<script> SetCompleted (); </script> "; Response. Write (jsBlock ); Response. Flush (); } Private void Page_Load (object sender, System. EventArgs e) { BeginProgress (); For (int I = 1; I <= 100; I ++) { SetProgress (I ); // Replace the actual operation with thread sleep, such as loading data. System. Threading. Thread. Sleep (50 ); } FinishProgress (); } } |