Indeed, you are correct that the code that I send you works only in a simple page since the id (that we use in code behind to expand/collapse the controls) of the RadPanelBar will change when placed in a content page. In such case, when you are trying to access different controls between the master and the content page, I would suggest that you take a look at the example here
where you can find the basic examples and detailed explanation on such scenario.
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed