Share via

Progress bar in asp.net

Santosh Umarani 81 Reputation points
2021-06-17T03:40:59.167+00:00

Hi all,

I want to show progress bar in asp.net page I have to read column 'BuildCompletedCount' from database from table 'TestResultAvailibiltyMaster'.
Basically BuildCompletedCount keeps getting updated upto 9. As and when count is getting updated the 'progress bar' should show the progress. Like when it reaches 9, it should as 100% with colour of the progress bar getting turned into green and in the beginning it should be yellow.

I am using asp.net with MVC and Sql server as database.

Kindly waiting for your response.

Thanks,
Santosh

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

Developer technologies | ASP.NET Core | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,106 Reputation points
    2021-06-22T08:00:42.237+00:00

    Hi @Santosh Umarani ,
    As far as I think,you could use bootstrap or jquery to implement the progress bar.This is like:

    $(document).ready(function() {         
            var count = 0;    
            var html = '';    
            $(".progress-bar").attr("aria-valuenow", "0"); //setting initial value of progressbar as ‘0’   
            $.ajax({   
             type: "POST",  
             url: "../ Progress/GetText",  
             contentType: "application/json; charset=utf-8",    
             dataType: "json",    
             async: false,   
             success: function(result) {  
                $.each(result, function(key, item) {    
                $('.table').hide();    
                html += '<tr>';    
                html += '<td>' + item.Name + '</td>';    
                html += '<td>' + item.Father’ sName + '</td>';    
                html += '<td>' + item.Gender + '</td>';    
                html += '<td>' + item.Address + '</td>';    
                html += '<td>' + item.Phone + '</td>';    
                html += '<td>' + item.Mobileno + '</td>';    
                html += '</tr>';    
                var myVar = setTimeout(updateProgress, 1, ++count, result.length, html);    
                html = "";    
            });    
            $('.table').show();    
        },    
        error: function(errormessage) {    
            $("#h3").text(errormessage.responseText);    
            return false;    
        }    
    });    
    

    More details,you could refer to below article:
    https://www.c-sharpcorner.com/article/progress-bar-in-asp-net-mvc/
    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.