ClientScript GetPostBack EventReference Partial Postback

InterServer Web Hosting and VPS

ClientScript.GetPostBackEventReference Partial Postback

On this page we'll look at how to do a Partial Postback with an UpdatePanel whilst using the ClientScript.GetPostBackEventReference method.

I ended up spending a couple of frantic hours trying to get my UpdatePanel to update using a Partial Postback. I was using the ClientScript.ClientScript.GetPostBackEventReference method to dynamically create some Javascript in C# which actually performs a postback from the client to the server, as if a user had clicked on a button for instance.

Partial Postback

The ClientScript.ClientScript.GetPostBackEventReference method works great in providing the javascript such that if a user causes a Javascript event to fire to which is wired from the output of this method, the page posts back to the server. However, I was having a hard time getting it to just do a partial postback, which makes for a nicer browser experience and also increases performance. But I finally found got it working.

Making ClientScript.GetPostBackEventReference Perform a Partial Postback

So here is how I got it to make a partial postback, basically by referencing the UpdatePanel which I wanted to perform the partial postback, hey presto, we have a partial postback.

myClass.PropertyExposedInRepeater = "javascript: " + ClientScript.GetPostBackEventReference(UpdatePanel_MyUpdatePanelName, "SomeUniqueIdentifier");

Sponsored Links
SolarSystem - AngularJS Demo
SolarSystem - Angular JS Demo

Check out my first Angular JS demo hosted in Azure, it helped win my first Angular contract. Put the sound on.