文件上传更新后的处理进展 [英] Update Progress on processing after fileupload
问题描述
我有两个上传控件一个WebForm和一些文本框的。
当按钮为pressed的文件遭到上传,然后得到处理。
上载不花时间,但该处理一样。
我知道我不能有一个更新面板上载控制,所以我不知道如何使用更新进度控制,以显示我的进步。
I have a webform with two upload controls and a number of textfields. When the button is pressed the files get uploaded and then get processed. The upload takes no time, but the processing does. I know I can't have an upload control in an update panel, so I can't work out how to use the update progress control to show my progress.
我与不工作的UpdateProgress控件页面如下:
My page with an updateprogress control that does work is as follows:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DynamicLayout="true">
<ProgressTemplate>
<div class="LOADING">
Your data is being processed<br />
<br />
<img src="/images/loading.gif" /><br />
<br />
Please wait...
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<div class="addFixture">
<asp:ValidationSummary ID="ValidationSummary1" ValidationGroup="fixture" runat="server" />
<label>
Type
<asp:DropDownList ID="ddlType" runat="server" AppendDataBoundItems="true">
<asp:ListItem Text=""></asp:ListItem>
</asp:DropDownList>
<label>
Date
</label>
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<label>
Name 1</label>
<asp:TextBox ID="txtName1" runat="server"></asp:TextBox>
<label>
Name 2
<asp:TextBox ID="txtName2" runat="server"></asp:TextBox>
<label>
First XML File</label>
<asp:FileUpload ID="firstFileUp" runat="server" />
<br />
<label>
Second Xml File</label>
<asp:FileUpload ID="secondFileUp" runat="server" />
<br />
<br />
<asp:Button ID="SubmitButton" runat="server" CausesValidation="true" Text="Submit" OnClick="SubmitButton_Click" />
<asp:Label ID="ErrorMessageLabel" runat="server" EnableTheming="false"></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
我已经寻找这一点,但人们似乎想要获得文件上传进度,而不是处理。
I have searched for this, but people seem to be trying to get the progress of the file upload and not the processing.
谁能帮助?
推荐答案
删除的UpdatePanel所有不能使用的FileUpload里面控制的方式。
添加到提交按钮OnClientClick属性具有以下值:的OnClientClick =showProgress()
同时添加到页面下方的javascript函数:
Remove the UpdatePanel as all the way you can't use FileUpload controls inside it.
Add to the SubmitButton OnClientClick property with following value: OnClientClick="showProgress()"
Also add onto the page javascript function below:
function showProgress() {
var updateProgress = $get("<%= UpdateProgress1.ClientID %>");
updateProgress.style.display = "block";
}
顺便说一句,可以考虑使用一些异步文件上传控制像一个来自Ajax控件工具包库
By the way, consider to use some async file upload control like one from the Ajax Control Toolkit library
这篇关于文件上传更新后的处理进展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!