How to fix the problem with new layout of the custom web part
In this article is shown how to correctly create new layout for your custom web part on the Layout tab.
If you want to create a new layout of the custom web part, you may sometimes encounter similar error:
http://server/KenticoCMS/CMSWebPartLayouts/<GUID>/myWebpart.ascx.cs(912305): error CS0115: 'ASP.cmswebpartlayouts_<GUID>_myWebpart___custom_ascx.FrameworkInitialize()': no suitable method found to override
You may need to set the relative path to the code behind file in the layout. Please find an example below.
Correct:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="~/CMSWebParts/_custom/custom.ascx.cs" Inherits="CMSWebParts__custom_custom" %>
Incorrect:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="custom.ascx.cs" Inherits="CMSWebParts__custom_custom" %>
See also:
Applies to: Kentico CMS 4.1 and all higher versions