In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "Code sharing in which asp. net threads obtain execution status through ajax when importing data in batches". In daily operations, I believe that many people have doubts about code sharing in which asp. net threads import data in batches and obtain execution status through ajax. The editor consulted all kinds of materials and sorted out simple and useful operation methods. Hope to answer "asp. net thread batch import data through the ajax to get the execution status of the code sharing" is helpful! Next, please follow the editor to study!
Code above: front-end page
Import data in bulk .pop _ body_con {width: 310px; position: fixed; top: 50%; left: 50%; margin-left:-150px; background: # eee; display:none;} .pop _ body_con .pop _ head {width: auto; padding: 10px 0; background: # fff;} .pop _ body_con .pop _ head a {display: block; color: # 717274; font-size: 12px; text-decoration: none; text-align: center } .pop _ box {width: auto; overflow: hidden; padding: 45px 10px;} .pop _ box .pop _ text {float: left;} .pop _ box .pop _ text p {padding: 0; margin: 0; font-size: 12px; line-height: 18px; color: # 717274;} .pop _ box .progress _ bar_con {float: left; width: 220px; position: relative; z-index: 2;} .pop _ box .progress _ bar_con p {margin: 0 Padding: 0; font-size: 12px; color: # fff; line-height: 18px; width: 100%; text-align: center; position: absolute; left: 0; top: 0; z-index: 4;} .pop _ box. Progress _ bar_con. Progress _ bar_start {width: 100%; height: 18px; background: # C4C0C0;} .pop _ box .progress _ bar_con. Progress _ bar_end {width: 16%; height: 18px; background: # 2bd35d Position: absolute; left: 0; top: 0; z-index: 3;} .pop _ box. Progress _ bar_con {float: left;} # loading-mask {width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; z-index: 0; background-color: rgba (0,0,0, 0.34902); display: none;} var MyInterval (function () {$("# startImport") .click (function () {MyInterval = setInterval (getState, 1000);});}) Function getState () {$.ajax ({url: "test.aspx", type: "Post", data: {action: "getSession"}, success: function (msg) {if (msg! = "null") {msg = eval ('('+ msg +')'); if (msg.being = 100) {setProcessBar (1,1); $(".pop _ body_con"). Hide () $("# loading-mask"). Hide (); clearInterval (MyInterval);} else {$(".pop _ body_con"). Show (); $("# loading-mask"). Show (); setProcessBar (msg.being, msg.count)}) } function setProcessBar (exeFlag, exeMax) {$("# progressbar_text") .html (parseInt (roundFun (exeFlag / exeMax, 2) * 100) + "%"); $("# progressbar_bar") .attr ("style", "width:" + parseInt (roundFun (exeFlag / exeMax, 2) * 100) + "%;");} function roundFun (number, X) {X = (! X? 2: X) Return Math.round (number * Math.pow (10, X)) / Math.pow (10, X);} is importing... Do not operate!
Import Progress:
0%
Background page:
Using System.Linq;using System.Threading;using System.Web;using System.Web.Script.Serialization;using System.Web.UI;using System.Web.UI.WebControls;public partial class test: System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {string action = Request.Form ["action"]; if (! string.IsNullOrEmpty (action)) {Hashtable temp = tmethod (); if (temp = = null) {Thread trd = new Thread (new ParameterizedThreadStart (insertData)) Trd.Start (action);} else {if (temp ["reCode"]. ToString () = "100") {Session.Remove ("process");}} JavaScriptSerializer ser = new JavaScriptSerializer (); String jsonStr = ser.Serialize (temp); Response.Write (jsonStr); Response.End ();} public Hashtable tmethod () {return (Hashtable) Session ["process"] } private void insertData (object obj) {string action = obj.ToString (); int tCount = 100; for (int I = 0; I < tCount; iTunes +) {Hashtable stateHash = setStateVal (0, I, tCount, action); Session ["process"] = stateHash; / / stored in session to facilitate sharing execution status Thread.Sleep;} Session ["process"] = setStateVal (100,tCount, tCount, action); Thread.CurrentThread.Abort () } private Hashtable setStateVal (int code, int beingV, int CountV, string action) {Hashtable stateHash = new Hashtable (); stateHash ["reCode"] = code; / / return status value stateHash ["being"] = beingV; / / executing value stateHash ["count"] = CountV; / / Total stateHash ["action"] = action; / / Total return stateHash;}
Ok, sharing complete!
At this point, the study on "asp. net thread batch import data through ajax to get the execution status of code sharing" is over, I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.