views:

32

answers:

0

(solved, see below)

Hi all

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);

Cheers Matthias

Solution:

You can just register your user control on the page as an async postback trigger. No more magic required. The reason it didn't work for me was a PostBackUrl property that was (accidentially) set on the button.

<asp:AsyncPostBackTrigger ControlID="myCustomControl" />