Why isn’t my page updating?

November 6, 2009

I’m sat at my desk, Internet explorer open alongside Visual Studio 2008 frantically clicking a button and wondering why on earth my label text is not updating.

I know when I click the button a postback occurs…I know I have a method tied to the button click event…I know this method is running…I can even check the value of MyLabel.Text in the immediate window and see that is is changing, but I still do not see the new value displayed in the browser.

After a short while I realised my frantic clicking wasn’t fixing my code *, so off I went for a quick coffee, a brain refresh and again examined the code, then the web form markup – The cause of the problem then dawned on me.

My button was inside an AJAX update panel. My Label was outside of this panel. Update update their contents only – They do not touch what’s outside (AKA Partial Page Rendering). The solution – Wrap the label in another update panel! I could also have dragged the label inside the same update panel as the button – But for reasons I wont go into (can’t remember!)  I added a second update panel.

* Einstein defined insanity as repeating the same action but expecting a different result – Something I’ll be we all do from time to time, have you read my blog before? 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: