ASP.Net Ajax : two common Gotcha's
1. GetPostBackEventReference of control inside UpdatePanel - performs full postback instead Partial postback :
This one can drive you nutters, since the __doPostBack call is almost the same for other elements which perform partial postback.
btn.Attributes["onclick"] = GetPostBackEventReference(this, string.Empty);
Although btn is inside the updatepanel - "this", the containing control, might not be - and that makes all the difference.
If the control's clientId is pre-registered during page load as a partial postback element - the postback will be partial. If not - it won't. So - if the parent (the IPostBackEventHandler) isn't held within an updatepanel - you're bound to eat *** until you find this post :)
2. RegisterClientScriptBlock() not working :
Well, this is one of the most annoying problems ever -
You setup a button inside an updatepanel, and call RegisterClientScriptBlock during it's event handler. Nothing happens.
Well - this is because the postbacker and the "this" object passed to the method call, aren't in the same updatepanel.
Either change "this" to the postbacker instance object, or put them both in the same updatepanel - vuila - it works.
Hope this helps, it sure would have helped me to have someone give me the solution for these two crappers...