+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / MVC-only pages & page headers

MVC-only pages & page headers

14 posts, 0 answered
  1. Mike
    Mike avatar
    4 posts
    Registered:
    23 Feb 2011
    28 Aug 2012
    Link to this post
    I am looking at moving our content over to MVC-only pages mostly to use the Kendou UI MVC tools that we purchased.  The biggest problem that I cannot find a solution for is being able to modify the <head> section of a MVC-only page.  It seems that for these "pure" type of pages, Sitefinity is ignoring the "HTML included in the <head> tag (except title, keywords, description)" section in Page Title and Properties.  (I hope that this is a bug that will be fixed.)

    Digging around the Telerik.Sitefinity.dll file I think that MVC-only pages are rendered using the Telerik.Sitefinity.Mvc.Rendering.PureMvcPageResolver() class.  There is a string in there called DefaultFrontendPageTemplate that points to an aspx page that I think is the basis for all MVC only pages.  The file is called "Telerik.Sitefinity.Resources.Pages.FrontendMvc.aspx and is embedded in the Telerik.Sitefinity.Resources.dll file.  Is there a way to override that string to point to a custom aspx page that can essentially serve as a master page for MVC-only pages?

    I considered MVC Layouts but I cannot find a way to modify the <head> section of the rendered page because the MVC widgets are rendered later in the page life cycle after the head tag has been created.
  2. Marin Atanasov
    Marin Atanasov avatar
    62 posts
    Registered:
    24 Sep 2012
    29 Aug 2012
    Link to this post
    Hello Mike,

    This is a known issue. You cannot add anything to the <head> tag in a Pure MVC page for the time being. You currently cannot change the DefaultFrontendPageTemplate either.

    There is a solution planned for 5.2 that will let you include HTML in the <head> tag by using a section.

    We are sorry for the caused inconvenience.

    Kind regards,
    Marin Atanasov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Mike
    Mike avatar
    4 posts
    Registered:
    23 Feb 2011
    18 Oct 2012 in reply to Marin Atanasov
    Link to this post
    Marin,

    I see that 5.2 has been released however the change log does not mention any changes the Sitefinity implementation of MVC.  Did this fix make it into the 5.2 build of Sitefinity?  If not, I really need a workaround to be able to modify the <head> tag of an MVC only page template.
  4. Marin Atanasov
    Marin Atanasov avatar
    62 posts
    Registered:
    24 Sep 2012
    22 Oct 2012
    Link to this post
    Hello  Mike,

    We could not get this feature ready for the release but it will be included in the service pack.

    We are terribly sorry for any inconvenience that this delay might cause you.

    Kind regards,
    Marin Atanasov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    12 Jun 2013
    Link to this post
    was this ever completed in any existing release?
  6. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    21 Nov 2016
    19 Jun 2013
    Link to this post
    Hi,

    We have fixed the problem and the fix will be included in our upcoming release Sitefinity 6.1. Fixing the problem required more development time, because we have another problem that was preventing this fix. Please excuse us for the inconvenience. Note that we haven't tested to place HTML in the head sections of the views, it is only tested if you place some code in Title and properties section of pages.

    Regards,
    Stefani Tacheva
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    12 Aug 2013 in reply to Stefani Tacheva
    Link to this post
    Hi,

    I thought it is possible already for a while with PowerTools?

    Although, I still don't sure hot to setup page title on pure MVC mode.
    If I use ViewBag.Title in my view PureMvcPageResolver throws "null reference" exception and I get YSOD. Can someone from Sitefinity confirm what is the way to set page title in MVC mode only????

    Thanks!
  8. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    12 Aug 2013 in reply to Denis
    Link to this post
    the power tools let you access and modify a layout template, but unless something has changed recently, they do not allow you to add Sections for rendering custom html or javascript.

    I checked the release notes for 6.1 and SP1 and don't see anything related to this. was this indeed released?
  9. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    12 Aug 2013 in reply to SelAromDotNet
    Link to this post
    Can you please elaborate what is the issue? Maybe it is Monday and my head is "slow".
    By modifying root template you can specify whatever code you want on head and other places. Reference your custom JS or CSS. Or you mean something that should be resolved on server side? Like <% Whatever.RenderMyCustomCode() %>???
  10. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    12 Aug 2013 in reply to Denis
    Link to this post
    what i'm referring to is pure MVC. if you create an MVC widget and attempt to have this widget render CSS or JS references in the master layout template as a Section, they do not work and nothing is rendered. I believe it works in Hybrid mode, but not pure mvc.
  11. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    12 Aug 2013 in reply to SelAromDotNet
    Link to this post
    Ah-hah, I see now. Yeah that would be a great if Sitefinity will support that. I join to this request!
    So far as a workaround I use combined CSS file that contains everything necessary in it.
    As for JS files, you still can include them in widget's view but it will be in the page's body (where widget is rendered).
  12. Tosho Toshev
    Tosho Toshev avatar
    8 posts
    Registered:
    15 May 2014
    15 Aug 2013
    Link to this post
    Hi Mike,

    The Sitefinity power tools allow you to create a root template and put your scripts there. The basic idea is to implement the IRootTemplateResolver class in your custom Resolver class and return the path to a template file. If you register your custom class on the Application_Start event in the Global.asax file it will act as a layout to your MVC views. Here is an example:
    https://github.com/Sitefinity/PowerTools/tree/master/Examples

    If you have more questions, please feel free to contact us.

    Regards,
    Tosho Toshev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Natalya
    Natalya avatar
    4 posts
    Registered:
    04 Oct 2013
    04 Nov 2013 in reply to Tosho Toshev
    Link to this post
    Hi Tosho,

    I'm trying to use https://github.com/Sitefinity/PowerTools/wiki/Root-Templates (for replacing pure MVC root template) and have an error (see log below) when trying to load page based on my Pure MVC template.
    ----------------------------------
    Timestamp: 11/4/2013 7:58:34 AM

    Message: HandlingInstanceID: f33e1d97-9ade-4105-921e-cfbc3212507f
    An exception of type 'System.NullReferenceException' occurred and was caught.
    -----------------------------------------------------------------------------
    11/04/2013 14:58:34
    Type : System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : Object reference not set to an instance of an object.
    Source : Telerik.Sitefinity
    Help link : 
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Void handler_PreRenderComplete(System.Object, System.EventArgs)
    Stack Trace :    at Telerik.Sitefinity.Web.PageRouteHandler.handler_PreRenderComplete(Object sender, EventArgs e)
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Web.UI.Page.OnPreRenderComplete(EventArgs e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Additional Info:

    MachineName : NIGU-PC
    TimeStamp : 11/4/2013 7:58:34 AM
    FullName : Telerik.Sitefinity.Utilities, Version=6.1.4600.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
    AppDomainName : 594390db-1-130280234712376966
    ThreadIdentity : 
    WindowsIdentity : Nigu-PC\Nigu
    Requested URL : http://localhost:60876/purepanel


    Category: ErrorLog

    Priority: 0

    EventId: 90000

    Severity: Error

    Title:Enterprise Library Exception Handling

    Machine: NIGU-PC

    App Domain: 594390db-1-130280234712376966

    ProcessId: 7804

    Process Name: C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.exe

    Thread Name: 

    Win32 ThreadId:6556

    Extended Properties: 
    ----------------------------------------
    ----------------------------------------

    How can I fix this error?

    Thanks,
    Natalya
  14. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    07 Nov 2013
    Link to this post
    Hello,

     I have tested and reproduced the problem, I have submitted the issue in github as power tools is open source project, here is the link for the issue.

    Regards,
    Stanislav Velikov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
14 posts, 0 answered