ASPX templates
Version 4.x > ASPX templates > Error in Masterpage codebehind View modes: 
User avatar
Member
Member
roopangee-hotmail - 7/17/2009 9:12:57 AM
   
Error in Masterpage codebehind
Hi,
I am creating master page for the purpose of template in my self created website in c# to avail kentico feature.( The website's bin has all the dlls and XMl inclued in the bin of downloaded sample KenticoCMS site)
I therefoer added code
<cc1:CMSPageManager ID="CMSPageManager1" runat="server" />
above the content place holder so as to manage editable region I will be.
trying to create .

However I am getting error :Unable to cast object of type 'ASP.home_aspx' to type 'CMS.UIControls.TemplatePage on the code

this.PageManager = this.CMSPageManager1;

on the code behind of master page.Hence I am unable to proceed.It is not searchable on the internet.
Is pagemanager specific to CMS as I had not used it earlier?
I request you to kindly suggest me a solution.

Thanks and Regards,
Roopangee Tandon

User avatar
Member
Member
kentico_pavelk - 7/27/2009 8:58:42 AM
   
RE:Error in Masterpage codebehind
Hello,

Could you please post here source code of the master page and also of its code behind?


Best Regards,
Pavel Knotek

User avatar
Member
Member
roopangee-hotmail - 7/30/2009 6:41:44 AM
   
RE:Error in Masterpage codebehind
I thank you for the reply.I got the error because I was creating a website independent of Kentico. I have rectified the error now.

Thanks and Regards,
Roopangee

User avatar
Member
Member
ramon.almarza-emtmadrid - 8/5/2009 9:18:02 AM
   
RE:Error in Masterpage codebehind
Hi, I have the same error, but I don´t know how I can solve it. Could you explain how you have solved the exception.

I need help please!!

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 8/5/2009 3:01:14 PM
   
RE:Error in Masterpage codebehind
Hi,

did you receive my e-mail?

Did you check the master page definition in the code behind?

It should be:

public partial class cmstemplates_emt_interiorempleados2: TemplateMasterPage

Best regards,
Helena Grulichova

User avatar
Member
Member
ramon.almarza-emtmadrid - 8/6/2009 2:27:29 AM
   
RE:Error in Masterpage codebehind
Yes, I've received your e-mail and i've cheked the master page definition. I send you an emanil with the code os the master page. I hope you can help me, please!! Thanks

User avatar
Member
Member
ramon.almarza-emtmadrid - 8/6/2009 9:30:08 AM
   
RE:Error in Masterpage codebehind
I’ve found the mistake. The problem was in the Template page and not in the master.Page. The template page inherited from System.Web.UI.Page and not from TemplatePage.

User avatar
Member
Member
hemanthray-gmail - 6/18/2010 11:55:40 AM
   
RE:Error in Masterpage codebehind
Can you please send me the fix I am having the same problem

User avatar
Kentico Support
Kentico Support
kentico_radekm - 6/27/2010 12:13:12 PM
   
RE:Error in Masterpage codebehind
Hello.

The fix should be easy. Could you please check, that your master page inherits from TemplateMasterPage class, and content page inherits from TemplatePage class? You can check it in page´s code-behind.

Best Regards,
Radek Macalik