LinkButtons in UpdatePanel cause full postback unless you give them IDs

Published 08 March 08 08:25 PM | alexcampbell

After tearing my hair out for half an hour, I have just figured out the painfully simple solution to a frustrating problem with UpdatePanels,Repeaters and LinkButtons.

The scenario: you have a Repeater in an UpdatePanel with LinkButtons in each RepeaterItem.  The LinkButtons fire Repeater.ItemCommand.  The problem is that every time you click on the LinkButton the page does a full postback - defeating the purpose of the UpdatePanel.

The solution: put IDs on your LinkButtons.  All of a sudden your LinkButtons are firing nice async partial-page postbacks.

Filed under: ,

Comments

# rajbk said on March 8, 2008 11:34 PM:

This is definitely a bug. It has to do with Data controls that don't render an ID for the parent container. The Repeater and ListView controls fall into this category.

Looking at the source code, it looks like an attempt is made to find the element in the dom tree or its parent container element or if was registered as an async postback control. If these fail, a full postback occurs.

You might want to post this on connect.microsoft.com

Thanks for the workaround.

Raj

# bec oates said on March 11, 2008 10:07 AM:

sounds interesting i guess........... if your into that kind of thing