Saturday, March 24, 2012

AJAX and Master Pages

I seem to be having some trouble using AJAX and the ControlToolkit with Master Pages.

Just to make sure, I created a new website based on the AJAXControlToolkit template.

and a simple default.aspx - it only has a scriptmanager, panel ( with some text in it), linkbutton and AnimationExtender.

it is set to show/hide the panel when the linkbutton is hovered on - this works as expected.

Then, I create a masterpage.master file and a new WebForm based on this master file.

using the same markup fro the default.aspx page, I get a page that looks the same as default.aspx

but does not show/hide the panel and has a Javascript error as follows:

Sys.ArgumentException:

AjaxControlToolkit.Animation.Animation.set_animationTarget requires the ID of a Sys.UI.DomElement or Sys.UI.Control.

No element or control could be found corresponding to 'Panel1'

Parameter name: id

It seems as though the controls are being renamed and I might need to change the TargetControlID on PageLoad or something.

Any ideas would be appreciated.

Mike

This is the difference between server ID and client ID. The .ClientID property of a control can be used to get its client ID and should help here.

No comments:

Post a Comment