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

Forums / Developing with Sitefinity / Find what files drive dynamic page

Find what files drive dynamic page

10 posts, 0 answered
  1. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    02 Jan 2010
    Link to this post
    I just received the site from the original developers. I have a page that is created dynamically and I am wondering how do I find out what are the pages driving it? Which master so on and so forth, because the page does not actually exist until you click on the link and it creates the page.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    03 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    If you are talking for the pages created by Sitefinity - all of them even does not exist physically. All Sitefinity pages are stored in the database and they inherits from Telerik.Cms.Web.InternalPage class.

    Which master so on and so forth, because the page does not actually exist until you click on the link and it creates the page

    The easiest way is to find the link which creates the page and see the logic that is executed on Click event. It is possible that Pages API is used.

    Kind regards,
    Ivan Dimitrov
    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.
  3. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    03 Jan 2010
    Link to this post
    Here is a snippet of code. How do I change whic page this brings up. I know which master it uses now, but I want to change to a different file when it is clikced..

    So now how do I change whic master it uses when the link is clicked?

    <asp:HyperLink ID="HyperLink3" CssClass="decor" runat="server" NavigateUrl='<%#string.Format("~/Comments/{0}.aspx?searchid={1}",DataBinder.Eval(Container.DataItem, "URL"),DataBinder.Eval(Container.DataItem, "ID")) + "&popup=true"%>' Target="_blank" runat="server">  
     
    <sfWebLib:SitefinityImage ID="Thumbnail" runat="server" /> 
     
    </asp:HyperLink> 
     

     

  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    04 Jan 2010
    Link to this post
    Hello Steven Lancaster,

    Thank you for getting back to us.

    As Ivan has mentioned earlier you can use the Sitefinity API to get the page you are currently on. You can check this article for more help - Finding Pages. To put it short on page load event you can get a reference to the current page you are on. Here is sample code snippet:
    protected void Page_Load(object sender, EventArgs e)
    {
        // create a new instance of CmsManager
        Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
        // get the current node of sitemap
        Telerik.Cms.Web.CmsSiteMapNode currentNode = (Telerik.Cms.Web.CmsSiteMapNode)SiteMap.CurrentNode;
        // get the CmsPage represented by the current node and extract its ID and Name
        Telerik.Cms.ICmsPage currentPage = currentNode.CmsPage;
        Guid currentPageId = currentPage.ID;
        string pageName = currentPage.Name;
    }

    You can also take a look at the rest of the members of the ICmsPage class.

    Kind regards,
    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.
  5. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    04 Jan 2010
    Link to this post
    Where do I put that code to run it? Can I do it from Sitefinity Admin?
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    04 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    Well this depends on where you actually wish to use it. Can you explain a little bit more about your use case scenario? If the sample markup that you have showed is from a control template (.ascx file) you can put this code inline in the template within <script runat="server"> tags. It will execute on each page load where you have this control.

    Regards,
    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.
  7. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    04 Jan 2010
    Link to this post
    using System;  
    using System.Collections;  
    using System.Configuration;  
    using System.Data;  
    using System.Web;  
    using System.Web.Security;  
    using System.Web.UI;  
    using System.Web.UI.WebControls;  
    using System.Web.UI.WebControls.WebParts;  
    using System.Web.UI.HtmlControls;  
    using DeepBlueCore;  
    using System.Text;  
     
    public partial class App_Master_reportswithtags : System.Web.UI.MasterPage  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (Common.QueryString("popup") == "true")  
            {  
                form1.Visible = false;  
                sidebar.Visible = false;  
            }  
        }  
    }  
     
    file.master

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="reportswithtags.master.cs" Inherits="App_Master_reportswithtags" %> 
     
    <%@ Register Namespace="Telerik.Cms.Web" Assembly="Telerik.Cms" TagPrefix="sf1" %> 
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head id="Head1" runat="server">  
    <title>The Nerve | Where government gets exposed</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <link rel="stylesheet" type="text/css" href="css/nerve-styles.css" /> 
    <meta name="description" content="" /> 
    <meta name="keywords" content="" /> 
    <!--[if lte IE 7]> 
              <link rel="stylesheet" type="text/css" href="css/nerve-ie.css">  
              <script defer type="text/javascript" src="/js/pngfix.js"></script>    
            <![endif]--> 
    <script language="JavaScript" type="text/javascript" src="/js/SpryTabbedPanels.js"></script> 
    <script language="javascript" type="text/javascript" src="/js/SpryDOMUtils.js"></script> 
    <link href="css/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> 
     
    <script src="/js/sifr.js" type="text/javascript"></script> 
    <link rel="stylesheet" href="/css/sifr.css" type="text/css">  
    <script type="text/javascript" src="/js/thickbox/jquery-latest.js"></script>   
        <script type="text/javascript" src="/js/thickbox/thickbox.js"></script> 
        <link href="/js/thickbox/thickbox.css" rel="stylesheet" type="text/css" /> 
     
    </head> 
    <body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
    <div id="page">  
      <div id='content_container'>  
        <!-- header: begin--> 
        <div id="header" runat="server">  
          <div id="headerInside">  
            <div class="part1">  
              <!-- CompanyLogo START--> 
              <div class="logo"><asp:contentplaceholder id="CompanyLogo" runat="server"></asp:contentplaceholder></div>  
              <!-- CompanyLogo END-->            
              <div class="rightHeaderBox">  
                <!-- begin grid_head_1--> 
                <div class="grid_head1">  
                  <ul class="utility-nav">  
                    <!-- UtilityNavigation Start--> 
                    <asp:contentplaceholder id="UtilityNavigation" runat="server"></asp:contentplaceholder>          
                    <!-- UtilityNavigation END --> 
                  </ul> 
                </div> 
                <!-- end grid_head_1--> 
              </div> 
            </div>   
            <!-- begin grid_head_2--> 
            <div class="grid_head2">  
                <div id="menu">  
                  <ul class="main-navigation">  
                    <!-- Main Navigation START--> 
                    <asp:contentplaceholder id="MainNavigation" runat="server"></asp:contentplaceholder>   
                    <!-- Main Navigation End-->                  
                  </ul> 
                </div> 
            </div> 
            <!-- begin grid_head_2--> 
          </div> 
        </div> 
        <!-- header: end --> 
        <div id="outer_wrapper">  
          <div id="wrapper">  
            <div id="iBlockInner" runat="server">  
              <!-- BlockAlbum START --> 
              <asp:contentplaceholder id="BlockAlbum" runat="server"></asp:contentplaceholder>   
              <!-- BlockAlbum END --> 
            </div> 
            <div class="content">  
              <!-- leftblock: begin --> 
              <div class="leftBox">  
                
                <div class="textBox">  
                <div class="addthisButton"><!-- AddThis Button BEGIN --><a shape="rect" href="http://www.addthis.com/bookmark.php?v=250&amp;pub=xa-4aeeb4dd2d5c4113" class="addthis_button" shape="rect"><img width="83" height="16" width="83" height="16" style="border-bottom: 0pt; border-left: 0pt; border-top: 0pt; border-right: 0pt;" alt="Bookmark and Share" src="http://s7.addthis.com/static/btn/sm-share-en.gif" complete="complete" complete="complete" /></a> <!-- AddThis Button END --></div>  
                <!-- Report Description START --> 
                <asp:contentplaceholder id="ReportDescription" runat="server"></asp:contentplaceholder>   
                <!-- Report Description END -->        
                </div> 
                  <div class="clearing"></div> 
                  <!-- bottom grid :begin --> 
                  <div class="clearfix grid-btBlock">  
                   <!-- Recent Reports START --> 
                   <div style="float:left; width:33%"><asp:contentplaceholder id="RecentReports" runat="server"></asp:contentplaceholder></div>  
                   <div style="float:left; width:33%"><asp:contentplaceholder id="Citizen" runat="server"></asp:contentplaceholder></div>  
                   <div style="float:left; width:33%"><asp:contentplaceholder id="Other" runat="server"></asp:contentplaceholder></div>  
                   <!-- Recent Reports END -->   
                 </div> 
                <!-- bottom grid :end --> 
              </div> 
              <!-- leftblock: end --> 
              <!-- sidebar: begin--> 
              <div class="sidebar" id="sidebar" runat="server">  
                
                <div class="search">  
                   <!-- Search Reports START --> 
                   <asp:contentplaceholder id="SearchReports" runat="server"></asp:contentplaceholder>   
                   <!-- Search Reports END -->   
                </div> 
                    
                <!-- Tabs: begin --> 
                <div class="TabbedPanels" id="tp1">  
                  <ul class="TabbedPanelsTabGroup">  
                    <li class="TabbedPanelsTab" tabindex="0">REPORTERS</li> 
                    <li class="TabbedPanelsTab" tabindex="0">ARCHIVES</li> 
                    <li class="TabbedPanelsTab" tabindex="0">TAGS</li> 
                  </ul> 
                  <div class="TabbedPanelsContentGroup">  
                    <div class="TabbedPanelsContent">  
                      <ul class="column-sm">  
                        <li>     
                            <!-- Reporters START --> 
                            <asp:contentplaceholder id="Reporters" runat="server"></asp:contentplaceholder>   
                            <!-- Reporters END -->   
                        </li> 
                      </ul>    
                    </div> 
                    <div class="TabbedPanelsContent">  
                      <ul>   
                        <li> 
                            <!-- Archives START --> 
                            <asp:contentplaceholder id="Archives" runat="server"></asp:contentplaceholder>   
                            <!-- Archives END -->   
                        </li> 
                      </ul>    
                     </div> 
                    <div class="TabbedPanelsContent">  
                    <ul>   
                        <li> 
                            <!-- Tags START --> 
                            <asp:contentplaceholder id="Tags" runat="server"></asp:contentplaceholder>   
                            <!-- Tags END -->   
                        </li> 
                      </ul>    
                    </div> 
                  </div> 
                </div> 
              
                 <!-- Tabs: end--> 
                  
                <div class="smblock-none">  
                   <!-- Blog START --> 
                   <asp:contentplaceholder id="Blog" runat="server"></asp:contentplaceholder>   
                   <!-- Blog END -->   
                </div> 
                  
                  
                <div class="smblock-bg">  
                  <!-- Movie START --> 
                  <asp:contentplaceholder id="Movie" runat="server"></asp:contentplaceholder>   
                  <!-- Movie END -->   
                </div> 
                  
                  
                 <div class="smblock-none">  
                   <!-- Issue START --> 
                   <asp:contentplaceholder id="Issue" runat="server"></asp:contentplaceholder>   
                   <!-- Issue END -->   
                </div> 
                  
                  
                 <div class="smblock-none">  
                   <!-- Donate START --> 
                   <asp:contentplaceholder id="Donate" runat="server"></asp:contentplaceholder>   
                   <!-- Donate END -->   
                </div> 
                  
              </div> 
              <!-- sidebar: end--> 
            </div> 
            <div class="clearing"></div> 
          </div> 
        </div> 
      </div> 
    </div> 
    <!-- footer: begin --> 
    <div id="footer">  
      <div id="footerInside">  
        <!-- Copy START --> 
        <asp:contentplaceholder id="Copy" runat="server"></asp:contentplaceholder>   
        <!-- Copny END -->        
        <div class="share">  
          <!-- StayUpdated START --> 
          <asp:contentplaceholder id="StayUpdated" runat="server"></asp:contentplaceholder>   
          <!-- StayUpdated END --> 
        </div> 
      </div>    
    </div> 
    <!-- footer: end --> 
     
     
    <script language="JavaScript" type="text/javascript">  
    var tp1 = new Spry.Widget.TabbedPanels("tp1", { defaultTab: 1 });  
    </script> 
    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4aeeb4dd2d5c4113"></script> 
    </form> 
    </body> 
    </html> 
     

    File.master.cs


    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="HomeBreakNew.ascx.cs" Inherits="Sitefinity_ControlTemplates_Blogs_HomeBreakNew" %> 
    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sfWebLib" %> 
     
    <telerik:CssFileLink ID="CssFileLink1" EmbeddedFileName="Telerik.Blogs.Resources.ControlTemplates.Frontend.blogsCommonLayout.css" FileName="" Media="screen" runat="server" /> 
     
    <sfWeb:HeaderLinks id="headerLinks" runat="server" /> 
     
     
     
    <asp:Repeater ID="repeater" runat="server" OnItemDataBound="repeater_ItemDataBound">  
     <HeaderTemplate> 
            <h2><a href="/Reports.aspx" style="text-decoration: none;" target="_blank" sfref="[Sitefinity]013b8069-85e2-41d6-b5c8-91ec55b7d0d0"><span style="color: #333333; font-size: 18px;">  
    BREAKING STORY</span></a></h2> 
        </HeaderTemplate> 
        <ItemTemplate> 
              
              
        <dl> 
            <dt> 
            <asp:HyperLink ID="HyperLink3" CssClass="decor" runat="server" NavigateUrl='<%#string.Format("~/Comments/{0}.aspx?searchid={1}",DataBinder.Eval(Container.DataItem, "URL"),DataBinder.Eval(Container.DataItem, "ID")) + "&popup=true"%>' Target="_blank" runat="server">  
                    <sfWebLib:SitefinityImage  ID="Thumbnail" runat="server"   /> 
                </asp:HyperLink> 
                  
            </dt> 
            <dd> 
            <p><asp:HyperLink ID="HyperLink1" runat="server"  NavigateUrl='<%#string.Format("~/Comments/{0}.aspx?searchid={1}",DataBinder.Eval(Container.DataItem, "URL"),DataBinder.Eval(Container.DataItem, "ID")) + "&popup=true"%>' Target="_blank"><strong><asp:Literal ID="Title" runat="server"></asp:Literal></strong></asp:HyperLink></p>  
            <class="by-post"><asp:Literal ID="ReporterName" runat="server"></asp:Literal></p>  
            <p><asp:Literal ID="content" runat="server"></asp:Literal></p>  
            <br /> 
            <asp:HyperLink ID="hplReadMore" runat="server"  NavigateUrl='<%#string.Format("~/Comments/{0}.aspx?searchid={1}",DataBinder.Eval(Container.DataItem, "URL"),DataBinder.Eval(Container.DataItem, "ID")) + "&popup=true"%>' Target="_blank">read more</asp:HyperLink> 
            </dd> 
        </dl> 
     
     
        </ItemTemplate> 
        <FooterTemplate> 
              
        </FooterTemplate> 
    </asp:Repeater> 
     

    ascx File

    Now what I am trying to do is change one of the hyperlinks to go to a page and pull in the information, but I want tio use a different master. I can not use this master file because it is used by other things. If I can copy the master and other files and manipulate the code however I want would be great, but I do not know where to make the change to point to the new files.




  8. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    04 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    So you need to make the page use a certain master page, based on some some criteria, if I understand you correctly. If this is the case the easiest way is to do this is to create a class that inherits from InternalPage and modify the page theme. Here we create a class that inherits IntrernalPage and then we set the theme and masterpage during the OnPreInit method.

    using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.HtmlControls; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using Telerik.Cms.Web; 
     
    /// <summary> 
    /// Summary description for MasterPageInternalPage 
    /// </summary> 
    public class MasterPageInternalPage : InternalPage 
        public MasterPageInternalPage() 
        { 
        } 
        protected override void OnPreInit(EventArgs e) 
        { 
            base.OnPreInit(e); 
            Page.Theme = "Orange with left sidebar"; 
            Page.MasterPageFile = "~/App_Master/test.master"; 
        } 

    We also changed Sitefinity/cmsenterypoint.aspx as below:

    <%@ Page Inherits="MasterPageInternalPage" MasterPageFile="~/Sitefinity/Dummy.master" %> 

    If you just want to change some properties of the controls that are in the page. You can just add the code I sent you to the ascx file:
    <script type="text/C#" runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        // create a new instance of CmsManager
        Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
        // get the current node of sitemap
        Telerik.Cms.Web.CmsSiteMapNode currentNode = (Telerik.Cms.Web.CmsSiteMapNode)SiteMap.CurrentNode;
        // get the CmsPage represented by the current node and extract its ID and Name
        Telerik.Cms.ICmsPage currentPage = currentNode.CmsPage;
        Guid currentPageId = currentPage.ID;
        string pageName = currentPage.Name;
    }
    </script>


    Regards,
    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.
  9. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    04 Jan 2010
    Link to this post
    Here is my problem. I have this site and the programmer set it up as blogs. So I have this blog that has a full page let's call it a story in it. I want to be able to click on the link and put the whole content in a window and the only thing I want have in is the story itself and a link to a page where they can leave comments. This will also be a printer friendly page. SO I will recap. On one page I have a partial blog and I want to click on the name of story on the blog open a new window and have it printer friendly with a link ONLY to go to another page where they can leave comments. This will be without modifying the current setup as to not interrupt other things going on.
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    04 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    Here are the steps you should follow.

    1. Create a custom control that derives from BlogsPost
    2. Override SetItemContent method and access the fullContent Hyperlink
    3. Set NavigateUrl to point to your page where you want to display only the content of the item, or just open the new window

    ctrl = FindContentViewControl("fullContent" + i, itemContainer);

    4. Create another control which will be bound to the content of the selected item or just use BlogPosts control in DetailsView where you have to use TextSettings options ( open the control in edit mode and go to "Settings")from the BlogPosts ControlDesigner to hide everything ( title, commnets, dates etc) except the content.

    5. To leave comments from the DetailsView, you can use the custom control and just add a hyperlink that redirects to a different or the same page.

    ctrl = FindContentViewControl("CommentsLink", itemContainer);
     if (ctrl is HyperLink)
     {
         HyperLink lnk = (HyperLink) ctrl;
         lnk.NavigateUrl = String.Format(lnk.NavigateUrl, navUrl);
     
     
        .....
                ....
     
      }


    Kind regards,
    Ivan Dimitrov
    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.
Register for webinar
10 posts, 0 answered