In a loop, I Can update the status for every record. So i need to show the status of record after the every single record updated. These should done when the button is clicked.
When i click start button it should updated the every record status in loop. Then i need to show every record status for every updates in UI.
protected void btnstart_Click(object sender, EventArgs e) { string pageId = string.Empty; divMsg.Style.Add("display", "none"); divMsg.Attributes.Add("class", ""); try { DataSet DsPages = (DataSet)ViewState["SitePages"]; bool IsSucess = false, IsError = false; string SqlQuery = string.Empty; if (DsPages.Tables[0].Rows.Count > 0) { for (int i = 0; i < DsPages.Tables[0].Rows.Count; i++) { try { htmlClean(DsPages.Tables[0].Rows[i]["contents"].ToString()); pageId = DsPages.Tables[0].Rows[i]["ID"].ToString(); SqlQuery = TransformXMLToHTML(htmldesign.InnerText, txtPageTypeXslt.InnerText.Trim()); SqlQuery = SqlQuery.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", ""); PagesBL objPage = new PagesBL(1); if (!string.IsNullOrEmpty(SqlQuery)) { if (objPage.ExecuteQuery(SqlQuery) > 0) { PagesBL objPageBL = new PagesBL(); objPageBL.UpdateLastExtract(DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"), DsPages.Tables[0].Rows[i]["ID"].ToString()); IsSucess = true; } } } catch (Exception ex) { IsError = true; string Error = ex.Message; PagesBL objPageBL = new PagesBL(); Errors objErr = new Errors(); objErr.PageID = pageId; objErr.ErrorOccuredOn = DateTime.Now; objErr.ErrorText = ex.Message; objErr.SQLError = ex.Source == ".Net SqlClient Data Provider" ? SqlQuery : ex.Message; objErr.ErrorStatus = 1; //1= objPageBL.InsertErrors(objErr); // divMsg.Attributes.Add("class", "alert alert-danger"); // divMsg.InnerText = "Extract process complete with few error.Please check the error list"; } } if (IsSucess && !IsError) { Session["Complete"] = "True"; divMsg.Style.Add("display", "block"); divMsg.Attributes.Add("class", "alert alert-success"); divMsg.InnerText = "Extract process completed."; } } } catch (Exception ex) { }}