后在ASP.NET显示进度条回 [英] ASP.NET display progress bar during post back
问题描述
我有一个表格和一个按钮上FileUpload控件。一旦一个按钮被点击的服务器上的文件转换成一个数据表,并遍历数据表中的记录进行验证。
I have a fileupload control on a form and a button. Once a button is clicked the server converts the file into a datatable and loops through datatable records for validation purposes.
我的问题:验证过程需要很长的时间,所以我想显示当前项目正在处理用户
My problem: the validation process takes a long time, so i wanted to display current item being processed to user.
我的尝试:我发现Ajax和SignalR在这样的情况下正在实施。然而,阿贾克斯需要一个更新面板工作不能与updatefile防治工作。我想SignalR和它的作品不过,回发时不能正常工作。 - >显然
My attempts: i found Ajax and SignalR being implemented in such scenarios. However, Ajax requires an update panel to work which cannot work with the updatefile control. I tried SignalR and it works however, it cannot work during a postback --> apparently.
任何人都可以帮助我找到解决办法。
Can anyone assist me in finding a solution.
感谢您!
推荐答案
嘿,你可以使用ajaxToolkit像这样
Hey you can use ModalPopupExtender of ajaxToolkit something like this
<ajaxToolkit:ModalPopupExtender ID="ProgressBarModalPopupExtender" runat="server"
BackgroundCssClass="ModalBackground" BehaviorID="ProgressBarModalPopupExtender"
TargetControlID="hiddenField" PopupControlID="Panel1" DynamicServicePath="" Enabled="True" />
<asp:Panel ID="Panel1" runat="server" Style="display: none; background-color: #C0C0C0;">
<p class="wait">Please wait!</p>
</asp:Panel>
<asp:HiddenField ID="hiddenField" runat="server" />
添加上面code任何地方在您的网页,然后在你的文件上传的按钮尝试这种
add the above code any where on your page then on your button of file upload try this
<input type="submit" value="Upload" id="upload"
causesvalidation="False" onclick="javascript:return validateAdd();"
onserverclick="btnupload_ServerClick" runat="server" />
在JavaScript
in javascript
function validateAdd() {
var myExtender = $find('ProgressBarModalPopupExtender');
myExtender.show();
return true;
}
和后面
protected void btnupload_ServerClick(object sender, EventArgs e)
{
// your code of upload
//
// your code of upload
ProgressBarModalPopupExtender.Hide();
}
这该怎么办
这篇关于后在ASP.NET显示进度条回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!