Take the 2-minute tour ×

I have a modal on a page that also contains a user control. When clicking the 'OK' button in the modal, I would like to update an updatepanel that is contained within the user control on the page. I have done this before but am having a brain-fart at the moment. Currently the 'OK' button on the modal does a full page post, I'd like to just update the panel, but I'm not sure how to add it as a trigger since it's not in the control the update panel is. Thanks.

I have a partial answer... I can update the panel once by doing this:

        Dim addTrigger As New AsyncPostBackTrigger
        addTrigger.ControlID = MyButton.ID
        addTrigger.EventName = "Click"

... this will cause a partial post-back the first time, but after that first time it causes an entire page reload. Any ideas?

share|improve this question

5 Answers 5

up vote 1 down vote accepted

You can explicitly add the OK button as a AsyncPostBackTrigger for the UpdatePanel. Like so

in the aspx markup for the UpdatePanel

<asp:UpdatePanel ID="updPanel" runat="server">
        <asp:AsyncPostBackTrigger ControlID="the control" EventName="Click" />

or in code-behind

    protected override void OnInit(EventArgs e)
        AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
        trigger.ControlID = "the Control";
        trigger.EventName = "Click";


share|improve this answer

Maybe I am missing some subtlety here, but can't you just call the Update() method on the Update Panel?

share|improve this answer
The problem is that the method (click event of the button) where I would call update() is causing the full page to post back. It needs to be a trigger to let the page know just to update that panel. –  Ryan Jul 27 '09 at 20:01
Ahh, got you. You'll probably need to add an asp:AsyncPostBackTrigger referencing the button in the update panel triggers. –  Dan Diplo Jul 27 '09 at 20:16

You can use the following pattern to control a panel postback in JavaScript:

var prm = Sys.WebForms.PageRequestManager.getInstance(); 
prm._panelsToRefreshIDs = UPComments.uniqueID;
share|improve this answer

Can't you just add an AsyncPostBackTrigger programmatically from the code-behind?

Like This ?

share|improve this answer

just put the contents of the Panel in an update panel sothat you have:

Your user control here.

this will also prevent the popup from disapearing until you want it to.

In your code behind you can then call it with popup.show(0 or pop.hide() and link these to your user control by addin gan event ot it and handling it inyour pages code behind. this way your user control can direct the popup what to do and when. you can even for it to update hte update panel if you needed for some reason.

for the case above tha tI just realized is tha tyou wan to updat ehte panel in the control. Create a method i nthe control that calls the update method o teh update panel an dthen fire that event from your page. It's the same principal in reverse. By utilizing event well you can wire up your application to do some pretty cool stuff.

share|improve this answer

Your Answer


