如何在回发触发器中添加进度栏 [英] How to add progress bar in postback trigger

查看:58
本文介绍了如何在回发触发器中添加进度栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在项目中使用更新面板.我在面板内部使用了两个按钮控件.我已经为该按钮提供了回发触发器,但是进度条不适用于该按钮控件.由于回发触发器.如果我删除回发触发器,则可以正常工作.但是我想将回发触发器添加到我的按钮中.谁能帮我解决这个问题.

I am using the update panel in my project. And I am using two button controls inside the panel. I have given postback trigger to that buttons but the progress bar is not working for that button controls. Because of the postback trigger. If I remove the postback trigger it works fine. But I want to add the postback trigger to my button. Can any one help me to solve this problem.

预先感谢

推荐答案

我发现了这一点,并且对我有用.您可以根据需要进行更改它适用于每个页面的回发,如果您要限制,则可以根据需要更改代码.

i found this and it works for me. you can change it according to your needs it works for every page postback, and if you want to restrict then change in code for your requirements.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.modalPopup
{
background-color: #696969;
filter: alpha(opacity=40);
opacity: 0.7;
xindex:-1;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
//Raised before processing of an asynchronous postback starts and the postback request is sent to the server.
prm.add_beginRequest(BeginRequestHandler);
// Raised after an asynchronous postback is finished and control has been returned to the browser.
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
//Shows the modal popup - the update progress
var popup = $find('<%= modalPopup.ClientID %>');
if (popup != null) {
popup.show();
}
}

function EndRequestHandler(sender, args) {
//Hide the modal popup - the update progress
var popup = $find('<%= modalPopup.ClientID %>');
if (popup != null) {
popup.hide();
}
}
</script>
<div>
<asp:UpdateProgress ID="UpdateProgress" runat="server">
<ProgressTemplate>
<asp:Image ID="Image1" ImageUrl="loader.gif" AlternateText="Processing" runat="server" />
</ProgressTemplate>
</asp:UpdateProgress>
<ajaxToolkit:ModalPopupExtender ID="modalPopup" runat="server" TargetControlID="UpdateProgress"
PopupControlID="UpdateProgress" BackgroundCssClass="modalPopup" />
<asp:UpdatePanel ID="pnlData" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click"/>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html> 

这篇关于如何在回发触发器中添加进度栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆