开发者

FileUpload Status Indicator ASP.Net C#

开发者_如何学运维

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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜