English 中文(简体)
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.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签