views:

229

answers:

2

Currently, i have a working function that will let user to upload an excel file and thn insert the excel file data into the SQL Server. So, they might be thousand of records in an excel file, i would like to have a message like "Please wait while uploading..." during the process! i have tried on the update progress and javascript but both of them do not work! u guys have any idea?

    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_initializeRequest(InitializeRequest);
    prm.add_endRequest(EndRequest);
    var postBackElement;

    function InitializeRequest() {
        if (prm.get_isInAsyncPostBack())
            args.set_cancel(true);
        postBackElement = args.get_postBackElement();

        if (postBackElement.id == 'btnUpload')
            $get('UpdateProgress1').style.display = 'block';

        alert("Please wait...");
    }

    function EndRequest(sender, args) {
        if (postBackElement.id == 'btnUpload')
            $get('UpdateProgress1').style.display = 'none';
    }
+1  A: 

I recommend you to use jquery block UI component.

kwon
A: 

I think you need an AJAX-style Javascript solution that displays the "please wait" message until it gets the "done!" message back from the server -- I don't believe you can do it otherwise than with JS and AJAX!

Of course you can implement that JS+AJAX with Dojo, jQuery, naked JS (not recommended), or any other framework (or lack thereof), but you do have to push suitable JS to the client and serve the resulting AJAX request from the server.

Alex Martelli