I'm working on an ASP.NET web forms application. In my Page I have an UpdatePanel
and a user control with an UpdateProgress
and a bunch of buttons. When the user clicks one of the buttons, I'd like to perform an asynchronous postback and show the UpdateProgress
.
Can anyone help me with making the postback asynchronous (looks like it works) as well as making the UpdateProgress
appear (doesn't work yet)?
Usually, this can be done pretty easily by defining an UpdateTrigger
in the page markup. Inside the user control it isn't. I exposed a public property AssociatedUpdatePanelID
, to have the UpdatePanel
's ID inside the control.
The UpdateProgress
is defined as follows:
<asp:UpdateProgress AssociatedUpdatePanelID='<%# AssociatedUpdatePanelID %>' />
That's what I tried in my control's Page_Load
, but none of the approaches works (postback is performed, but UpdateProgress
does not appear):
updatePanel.Triggers.Add(new AsyncPostBackTrigger()
{
ControlID = this.ID,
EventName = "RequestOptimize"
});
var scriptMgr = ToolkitScriptManager.GetCurrent(Page);
scriptMgr.RegisterAsyncPostBackControl(optimizeButtonJobs);
scriptMgr.RegisterAsyncPostBackControl(this);