views:

517

answers:

2

There are other similar posts, but they all want a progress bar. I don't care.

I will probably end up buying Ajax Uploader, but I would like to know if there is a way to just let the user know if a file is in the process of being uploaded. I have tried an Ajax ProgressIndicator but it doesn't work...The file upload part works, but the progresscontent does not get displayed.

Here is what I have without the Ajax:

<asp:FileUpload onchange="clickTheButton();" ID="FileUpload1" runat="server" />
<asp:Button ForeColor="#ffffff" BackColor="#ffffff" BorderColor="#ffffff" BorderWidth="0"
                ID="Button1" runat="server" Text="Add Image" OnClick="AddImage_Click" />

Just a file upload control and a button that uploads the file.

All I need is a way to let the user know that it is busy sending the file.

A: 

Just query your server at reasonable intervals with Ajax to see if the file you're trying to upload exists yet, and show an appropriate indication based on the response.

JoshJordan
This is more of a 1-5 second operation. I don't think this approach makes sense. I just want the user to know something is happening. As soon as the file is uploaded it appears in a datalist. I just need something to say Uploading... between the time they click and the time the DataList is repopulated.
Blankasaurus
I'm a little confused on what you're asking for then. Just attach a Javascript event to the form button. When its clicked, hide the upload control and show an element that indicates that the upload is in progress.
JoshJordan
Good point. I've been up too long.Ended up using Uploadify. Does multiple files and its easy. Although I think I am going to write an article on how to use it in ASP.Net, because there isn't an article making each step clear. I'll post a link if I get around to writing it.
Blankasaurus
That would be awesome - please do!
JoshJordan
+1  A: 

Why not just create some hidden element on the page like this:

<div id="loadingDiv" style="display: none;">Please wait, uploading file...</div>

and then in the OnClientClick of your upload button, return a function like so:

function displayWaitingMessage(){
    document.getElementById('loadingDiv').style.display = 'block';
    return true;
}

Should display the message and then proceed with the postback to upload the file.

Rudism