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

Forums / Developing with Sitefinity / run custom code on custom page level properties

run custom code on custom page level properties

2 posts, 0 answered
  1. Anthony Smith
    Anthony Smith avatar
    34 posts
    Registered:
    08 Dec 2009
    14 Dec 2009
    Link to this post
    Hi
    I want to inject our HTML code explicitly in all sf pages on runtime, independent of what masterpage that page is using.

    One way is to go to every masterpage and inject code on Page_Load, but ideally i want to do it explicitly on all pages in one central palce.

    My reason for this is because i want to run some custom logic based on some custom page level properties which i'm adding.

    Is this possible?

    Thanks
    Anthony
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    15 Dec 2009
    Link to this post
    Hi Anthony Smith,

    Thank you for using our services.

    You can create a class that overrides from InternalPage. Then put your logic on its on load  event:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Cms.Web;
     
    /// <summary>
    /// Summary description for CustomInternalPage
    /// </summary>
    public class CustomInternalPage: InternalPage
    {
        //try overriding
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
        }
    }

    Then substitute the built in internal page with yours in ~/Sitefinity/cmsentrypoint.apsx:
    <%@ Page Inherits="CustomInternalPage, App_Code" MasterPageFile="~/Sitefinity/Dummy.master" %>

    This should make all CMS pages use the common logic. The other way is to create a custom IHttpModule.

    All the best,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered