Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:29:13+00:00 2026-06-05T15:29:13+00:00

I use ASP.NET I want to show percentage to user from codebehind while database

  • 0

I use ASP.NET

I want to show percentage to user from codebehind while database working .

I think problem is here,when i call this function from cs percentege WORKS FINE!

  protected void btnUpdate_Click(object sender, EventArgs e)
  {
        System.Threading.Thread.Sleep(5000);
  }

But my real code is connect a database and insert 300 – 1000 rows !!
When it works server cursor icon changed to busy icon,so it frozen and i cant set my percentage value.

Plz Help…

I got a webservice :

    public double CommittedCount = 0;

    [WebMethod]
    public string ShowPercentage()
    {
        return ((CommittedCount / FinishCount) * 100 ).ToString();
    }

    [WebMethod]
    public void SetCommittedCount(double committedCount)
    {
        CommittedCount = committedCount;
    }


    public double FinishCount
    {
        get
        {
                if(Glob.ExcelDataSet.Tables[0].Rows.Count > 0)
                    return Glob.ExcelDataSet.Tables[0].Rows.Count;
                return 1;

        }
    }

I got an ajaxcall function:

function updateProgress() {
        $.ajax({
            type: "POST",
            url: '<%=ResolveUrl("~/processCalculator.asmx/ShowPercentage") %>',
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: true,
            success: function (msg) {
                // TODO: revert the line below in your actual code
                //$("#progressbar").progressbar("option", "value", msg.d);
                $(".percentage").text(msg.d);
                if (msg.d < 100) {
                    setTimeout(updateProgress, 100);
                }
            }
        });

    }

I called updateProgress button onclick:

<asp:Button Text="Sorgula" ID="btnAction" class="button_action" OnClick="Action_Click" Width="80px" runat="server" />

        $(".button_action").click(function () {
            var action_ = $(this).attr("value");
            var ExcelRowCount = $('#<%=ExcelActionsIsAvaibleRowCount.ClientID %>').val();
            if (ExcelRowCount != "") {
                if (confirm(ExcelRowCount + " kayıt için [" + action_ + "] aksiyonu gerçekleştirilecek?")) {
                    setTimeout(updateProgress, 100);
                    return true;
                }
                else 
                {
                    return false;
                }
            }
        });

My Cs Action Code
protected void btnAction_Click(object sender, EventArgs e)
{

...
...
for (int rowIndex = 1; rowIndex < Glob.ExcelDataSet.Tables[0].Rows.Count; rowIndex++)
{
   ...     
   ...                

   aksiyon_sonucu_ = action.InsertRow(
   Glob.ExcelDataSet.Tables[0].Rows[rowIndex], DegistirilebilirKolonlar, true);

  // my persentage
  processCalculater pCal = new processCalculater();
  pCal.SetCommittedCount(rowIndex);

  ...
  ...

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:29:14+00:00Added an answer on June 5, 2026 at 3:29 pm

    You need to use PageAsyncTask (or some other multithreading).

    Here’s the article on usage from MSDN, which also has an example that shows a progress indicator.

    http://msdn.microsoft.com/en-us/library/system.web.ui.pageasynctask.aspx

    Other options for multithreading are:

    ThreadPool.QueueUserWorkItem(s => System.Threading.Thread.Sleep(5000))
    

    and

    new Thread(() => System.Threading.Thread.Sleep(5000)){ IsBackground = true }.Start() 
    

    The idea is to put your long running task into a background thread (using any of the techniques above). Pass in your context (session) to save your progress. Then using AJAX and a WebMethod, you can access the session data and show the progress of the background thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net user control on which I want to use jquery ajax.
i want to use this plugin in my asp.net application i want to show
I want to use ASP.NET and IIS to download dynamically generated files to the
I want to use ASP.Net on Linux because of license problems and costs. Can
How to use forms authentication without login control.I don't want to use asp.net login
In my Asp.net MVC 1.0 application I want to use CKEditor as my Rich
I want to use code beside files for my views in my ASP.NET MVC
I want to use the Saxon-B XQuery class in my ASP.Net website. But my
In my Controller in a Asp.net MVC 1 app I want to use UpdateModel
I have a code base I want to use for both an ASP.NET MVC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.