Optional sidebar menu
Social media
Contact information

September 2017: Change of address in progress.


[email protected]


+353 87 2446653

Sulware Blog

Postback from a button within a user control inside an UpdatePanel

05/04/2016 Posted by Brendan O'Sullivan | Comments(0)

Key Areas:

ASP.NET, C#, Software Development, Tutorials, Web Development
Postback from a button within a user control inside an UpdatePanel

OK, it's a convoluted title.  And it's probably not a very common use case, but I've run into this issue at least twice in the last 6 months, so I decided t write this small blog note on how I get around it. 

Here's the case:

I have a user control, which has a button that requires a full page post back, for whatever reason.

I take this lovely user control and put it into an updatepanel along with other controls that I want to include in the partial Ajax update on one of my pages.  So all these other controls work fine in the update panel, but that page PostBack control within the user control isn't working.

Ideally what I want to do is just put the id of the control into a <postback> tag in the <triggers> section of the updatepanel. 

However that throws an error because at that page level the ID of the control in the user control can't be directly referenced.

Got the problem?

The solution is actually relatively straight forward, (at least the solution I'm using is).

The trick is to :

1) Add a property to your user control to just return back the control.

2) Within your Page_Load of the page, you can then just register the postback control directly using the following:


where myBtn is the call to the user controls property that returns the control in question.

That's it really.

Give it a whirl.


About the Author

Brendan O'Sullivan

Brendan O'Sullivan is a computer science graduate of DIT and has been working professionally as a software/web developer, Systems Architect and IT consultant since 1993. After spending 3 years with IBM, he went on to found Sulware in 1996. He has worked with a vast array of companies from large multi nationals to small family run businesses. Brendan also holds technical directorships with a number of other Irish based companies.

Add a Comment

Notify of New Replies:
Add a new comment:

Latest Posts



Latest Comments