[英]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. 我可能最终会购买Ajax Uploader,但我想知道是否有办法让用户知道文件是否正在上传过程中。 I have tried an Ajax ProgressIndicator but it doesn't work...The file upload part works, but the progresscontent does not get displayed.
我已经尝试了Ajax ProgressIndicator但它不起作用...文件上传部分工作,但progresscontent没有显示。
Here is what I have without the Ajax: 这是我没有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: 然后在上传按钮的OnClientClick中,返回如下函数:
function displayWaitingMessage(){
document.getElementById('loadingDiv').style.display = 'block';
return true;
}
Should display the message and then proceed with the postback to upload the file. 应显示消息,然后继续回发以上载文件。
只需使用Ajax以合理的间隔查询服务器,看看您尝试上传的文件是否存在,并根据响应显示适当的指示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.