How to show "loading" screen with modal bootstrap in any c#server process

Asked

Viewed 1,591 times

1

I need my pages to show the whole server process a screen with a type of Carrying using the modal bootstrap I created below. My problem is to be able to show this in all processes.

  • Is there any way to do that?
  • Does anyone have any idea?

My code:

<div class="container">
                <div class="modal fade bs-example-modal-sm" id="modalProcessando" tabindex="-1"
                    role="dialog" aria-hidden="true" data-backdrop="static">
                    <div class="modal-dialog modal-sm">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title">
                                    <span class="glyphicon glyphicon-time">
                                    </span>&nbsp;Aguarde
                                    </h4>
                            </div>
                            <div class="modal-body">
                                <div class="progress">
                                    <div class="progress-bar progress-bar-info
                                    progress-bar-striped active"
                                    style="width: 100%">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

1 answer

1


You can do this for all ajax of your application by using the events global.

Example:

$(document).ajaxSend(function () {
    ///chama seu processando
});

$(document).ajaxComplete(function () {
    //finaliza seu processando
});

You can also use the .ajaxError() to create a global error handling, as I explained here.

  • I appreciate the information you’ve given me, but apparently it doesn’t work for what I want.. this procedure performs perfectly at the opening of the page, but in all other procedures nothing happens.. Am I doing something wrong? Do you have any idea what it might be?

  • @Alisonvieira, then friend, this process will work only for your ajax requests. for the more I use in my applications in a slightly different way. I create the waitbar from a specific class and leave it on the body of all my pages, when finishing the loading with $(Document). ready I remove the class.

  • 1

    thank you very much for your help.. in fact the tip you gave me did not solve, but I found another way to do that worked perfectly as I wanted.. I just define the onchange of all the controls I need this process and when it ends I just make the call to close the modal.. Anyway, I will define your answer as correct, because in the tests I realized that it works too, for other ways to do.. = D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.