More in this section

Forums / General Discussions / 4.0 Templates Using Masterfiles

4.0 Templates Using Masterfiles

11 posts, 1 answered
  1. Chris
    Chris avatar
    63 posts
    Registered:
    05 Jan 2011
    06 Jan 2011
    Link to this post
    Are there any sample masterfile templates available for download?  We're trying to setup a template via the masterfile option.  My code follows your sample as follows:

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="HomeTemplate.master.cs" Inherits="App_Master_HomeTemplate" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
        <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <form id="form1" runat="server">
         
        <div id="Header">
            <asp:ContentPlaceHolder ID="Header" runat="server"></asp:ContentPlaceHolder>
        </div>
         
        <div id="Content">
            <asp:ContentPlaceHolder ID="Content" runat="server"></asp:ContentPlaceHolder>
        </div>
         
        <div id="Footer">
            <asp:ContentPlaceHolder ID="Footer" runat="server"></asp:ContentPlaceHolder>
        </div>
     
        </form>
    </body>
    </html>

    However, when I try to add it to the site, I'm getting the following error:

    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load type 'SitefinityWebApp.App_Master.HomeTemplate'.

    Source Error:

    Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="HomeTemplate.master.cs" Inherits="SitefinityWebApp.App_Master.HomeTemplate" %>
    Line 2:  
    Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    Source File: /MyProject/App_Data/Sitefinity/WebsiteTemplates/HomeTemplate/App_Master/HomeTemplate.Master    Line: 1


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1


    I've also tried using your example inherits line as follows:
    Inherits="App_Master_HomeTemplate"
    but the result is the same.  Thanks for any help on straightening this out!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Jan 2011
    Link to this post
    Hi Chris,

    I attached a working master page which is added inside App_Master folder in the root.



    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    06 Jan 2011
    Link to this post
    Hi Chris,

    Don't forget that in SF4 before you try to add your new template based on your .master file you need to compile/build your web project in visual studio. If you don't build it, it's not able to find the inherited code in the code behind file. Note that in SF3.x you didn't have to do this, this requirement is new for SF4.

    Another option is if you don't need any code behind in your master page then you can remove the CodeBehind and Inherits attributes so that it's only using the .master file and not .master.cs

    Regards,
    Phill
    Answered
  4. Chris
    Chris avatar
    63 posts
    Registered:
    05 Jan 2011
    06 Jan 2011
    Link to this post
    Hi Phil,

    Thanks for the response.  I went ahead and rebuilt the solution in Vis Studio but now the whole application is throwing the following error:

    Server Error in '/MyProject' Application.

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Could not load file or assembly 'Telerik.Sitefinity' or one of its dependencies. The system cannot find the file specified. (C:\Program Files (x86)\Telerik\Sitefinity 4.0\Projects\MyProject\web.config line 113)

    Source Error:

    Line 111:    <httpModules>
    Line 112:      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    Line 113:      <add name="Sitefinity" type="Telerik.Sitefinity.Web.SitefinityHttpModuleIIS6, Telerik.Sitefinity"/>
    Line 114:      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI"/>
    Line 115:      <add name="SitefinityAnalyticsModule" type="Telerik.Sitefinity.Analytics.Server.DependencyResolution.Module.DependencyRegistrarHttpModule, Telerik.Sitefinity.Analytics.Server.DependencyResolution"/>

    Source File: C:\Program Files (x86)\Telerik\Sitefinity 4.0\Projects\MyProject\web.config    Line: 113


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1



    The only change I made was the addition of a new Template under App_Data/Sitefinity/WebsiteTemplate and a corresponding master file.

    Any ideas what I did wrong?
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Jan 2011
    Link to this post
    Hi Chris,

    Could you check whether the required dll is located in your bin? When you perform rebuild this clears your bin folder in Web Application environment. If this is the case you can get the dlls from another project that you can install for less then a minute through the Project Manager.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Chris
    Chris avatar
    63 posts
    Registered:
    05 Jan 2011
    06 Jan 2011
    Link to this post
    Hi Ivan,

    I'm still in Trial mode trying to figure out if this will meet our needs and it looks like the Project Manager only allows for one project while in Trial?  The following files are in the bin folder of my project:

    - Facebook.Web.dll
    - Facebook.Web.xml
    - Interop.DexterLib.dll
    - SitefinityWebApp.dll
    - SitefinityWebApp.pdb
    - Telerik.Web.Design.dll
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Jan 2011
    Link to this post
    Hello Chris,

    Telerik.Sitefinity.dll is not presented in your bin, please add it following suggestions from the previous post.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Chris
    Chris avatar
    63 posts
    Registered:
    05 Jan 2011
    06 Jan 2011
    Link to this post
    Hi Ivan,

    I cannot create a new project in the Project Manager because it's in Trial mode.  What are my alternatives for getting the DLL?  Thanks!
  9. Chris
    Chris avatar
    63 posts
    Registered:
    05 Jan 2011
    06 Jan 2011
    Link to this post
    Just found an _emptyProject folder in the Telerik directory which had everything in the bin folder.  It appears to be in working order thank you!

    Chris
  10. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    14 Jan 2011
    Link to this post
    Concerning the compile/build process for adding/updating master pages... is this really the only way?

    Months back, it was said that Sitefinity 4 would support building a site as a Web Site or a Project in Visual Studio. Now it seems like we have lost the Web Site option. Could someone please clarify on this?

    While I am aware of the benefits of a compiled site, we would rather not lose the flexibility of developing as a Web Site where we don't need to rebuild for otherwise minor updates.
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 Jan 2011
    Link to this post
    Hi Will,

    Sitefinity 4.0 is shipped as a web application, but you can convert it as a website.  You have to open the web application as a website from Visual Studio and then save the solution.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
11 posts, 1 answered