Wednesday, March 28, 2012

Multiple UpdateProgress on a page?

My UpdateProgress Panel gets fired when I use my modalpopup box. Is there anyway for the modal popup to have its own progress and not trigger the one already defined on the page?

If you define aasp:UpdateProgressin a web form and specify an AssociatedUpdatePanelID?property for it, it will be triggered?and?display?the?
AssociatedUpdatePanel when you press any control in the web form.
Try the following codes and check if it works in your project.
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
var postBackElement;
function InitializeRequest(sender, args) {
if (prm.get_isInAsyncPostBack())
{
args.set_cancel(true);
}
postBackElement = args.get_postBackElement();
if (postBackElement.id == 'ButtonTrigger')
{
$get('UpdateProgress1').style.display = "block";
$get('ButtonTrigger').style.display = "none";
}
}
function EndRequest (sender, args) {
if (postBackElement.id == 'ButtonTrigger')
{
$get('UpdateProgress1').style.display = "none";
$get('ButtonTrigger').style.display = "block";
}
}
function AbortPostBack() {
if (prm.get_isInAsyncPostBack()) {
prm.abortPostBack();
}
}
</script
<div>
<asp:Button ID="ButtonTrigger" runat="server" Text="Refresh Panel 5" OnClick="Button_Click" />
<asp:UpdatePanel ID="UpdatePanel5" runat="server">
<ContentTemplate>
<%=DateTime.Now.ToString() %> <br />
The trigger for this panel
causes the UpdateProgress to be displayed
even though the UpdateProgress is associated
with panel 2.
<br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ButtonTrigger" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel6" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<%=DateTime.Now.ToString() %> <br />
<asp:Button ID="Button2" runat="server" Text="Refresh Panel 6" OnClick="Button_Click"/>
</ContentTemplate>
</asp:UpdatePanel>
<span style="display: inline-block;">
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/airplane.bmp" />
</ProgressTemplate>
</asp:UpdateProgress>
</span>
</div>
Wish the above can help you.

No comments:

Post a Comment