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

Forums / Developing with Sitefinity / Slow Page Management with 1000's of Pages - With SP3 Patch Installed

Slow Page Management with 1000's of Pages - With SP3 Patch Installed

31 posts, 0 answered
  1. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    04 Jun 2010
    Link to this post
    We have installed the SP3 patch to our Sitefinity site. Although performance has improved, the load times for pages in the Site Map within the admin is incrediably slow.

    We have one page group that contains over 1000 pages, and it takes nearly a minute if not longer to click and page and have it load so it can be edited.

    Any help would be appreciated.

    Thanks
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    04 Jun 2010
    Link to this post
    Hi mcpdinkansas,

    Thank you for using our services.

    Unfortunately this is how Sitefinity 3.x CMS is designed. If you have too many pages under the same node you will experience slow downs in performance. We have done whatever can be done to optimize the performance for the current architecture. Our only suggestion would be that you distribute your pages in a way that you do not have 1000 pages under one node.

    We are working on a better architecture for the next version of the CMS - Sitefinity 4.0. It will have much better performance when dealing with items in the magnitude of hundreds of thousands and more.

    Greetings,
    Radoslav Georgiev
    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. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    04 Jun 2010
    Link to this post
    Hey Radoslav,

    That is not good news. Would your team be willing to help us modify the Sitefinity Admin to provide a more custom solution for page management?

    What we would need is the code for the Pages Sitemap, and how it works.

    Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    06 Jun 2010
    Link to this post
    Hi mcpdinkansas,

    There are many internal dependencies ( between SiteMapPanel, ManagePagesGrid, PageEditor
    PagePropertie classes) that will not allow you to implement your own SiteMap control.  The changes that should be done are not just in a single control or class.  The solution will require binding the control through Web Service which means that we have to override about 5 classes and make the relation between them based on client events instead of server events.

    Currently we are in process of development of the new version - Sitefinity 4.0 where such problems will be sorted out. We will release regular Service Packs that will include RadControls updates and bug fixes, so I could log your request as "Feature Request" that could be included in one of the next Service Packs.

    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.
  5. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    07 Jun 2010
    Link to this post
    Unfortunately we need to launch this site very soon, and the performance issue is the last issue we need to resolve before we can go live.

    We do not have the time to wait for 4.0. Could you give me a possible ETA for my Feature Request to be available within a patch?

    We need a custom solution fast, and I will be pressing forward with one, so any help would be very appreciated.

    Thanks
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Jun 2010
    Link to this post
    Hello mcpdinkansas,

    Currently I cannot give you a time frame, because the issue has not been taken by someone for fixing. Also we have to consider whether to spend some efforts on this, since it is a new implementation, because we are in active development of Sitefinity 4.0 and generally there will be only bug fixes for Sitefinity 3.x editions.
    We will not be able to resolve this issue before the middle of August.

    The only way that I could suggest for now is to split the pages, so that you will not bind 1000 nodes of a single request.

    Such problems are sorted out in Sitefinity 4.0 which architecture is capable to work with thousand of pages

    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.
  7. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    07 Jun 2010
    Link to this post
    Hey Ivan,

    I understand that implementing this with the release of 4.0 this year would be redundant.

    Is there any way you could provide me the code of how the Pages.aspx works within the admin, including controls? The splitting up of the pages is unfortunately not an option in this case, they will need to remain under their respective page groups.

    I am actively creating a custom solution, and any help from Telerik will help speed up this process.

    I appreciate your communications, but I do need some technical help here. Unfortunately as stated, we cannot split the pages and we cannot wait until August or for the release of 4.0.

    If releasing this information goes against policy to protect your product, please provide all options I have at my disposal.

    Thanks

  8. Kalina
    Kalina avatar
    176 posts
    Registered:
    27 Oct 2016
    07 Jun 2010
    Link to this post
    Hi mcpdinkansas,

    The treeview in the pages sitemap was created to hold typical web site hierarchies and can easily accommodate around 150-200 pages under the same node. The scenario you cite is quite unusual, and unfortunately at this moment we do not support it.

    What we would advise is:
    1) Break the architecture into smaller chunks and group pages under parent pages;  
    2) Instead of pages, use some of the content modules (i.e. News) and the corresponding public controls to create lists of HTML pages;
    3) Hide the Page treeview. The treeview is helpful when browsing hierachical and in your case users might not find it helpful. They can use the grid with pages which is quite fast.

    If you provide us with more details on your projects, and why you decided to organize all pages under one node, we might be able to propose even more options.

    Regards,
    Kalina
    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.
  9. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    07 Jun 2010
    Link to this post
    Hey Kalina ,

    I have started down the path of option 3 that you have suggested. One feature I am trying to implement is adding DropDownList's of all PageGroups to replace of the Site TreeView that will filter the List.

    The reason we have so many pages under a single page group is to keep the current architecture of the static site we are moving into Sitefinity. We can not split the pages into Sub Page Groups or other Page Groups due to external sites linking to these pages. We have written a Redirect Service that evaluates the current request and will point the users from a .html page to a .aspx page. To keep this Redirect Service, we need to maintain the current site's architecture.

    If you could provide any help with having my DropDownList controls of Page Groups filter the AllPagesList.ascx control that would be great.

    Thanks
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Jun 2010
    Link to this post
    Hi mcpdinkansas,

    You have to set Visible property to false of the RadComboBox that represents the SiteTree under Sitefinity\Admin\ControlTemplates\Pages\SiteMapPanel.ascx. Then you have to implement a web service and bind RadComboBox to it. Below is the code that you have to use

    SiteMapPanel.ascx

    <script type="text/javascript">
     
        function OnClientItemsRequesting(sender, args) {
            var context = args.get_context();
        }
     
    </script>
     
    <telerik:RadComboBox  ID="RadComboBox1"  OnClientItemsRequesting="OnClientItemsRequesting" runat="server" Width="180px" Height="200px" EnableLoadOnDemand="true">
            <ExpandAnimation Type="none" />
            <CollapseAnimation Type="none" />
            <WebServiceSettings Path="~/Sitefinity/Admin/Services/RadComboBoxWebService.asmx" Method="GetCmsPages" />
    </telerik:RadComboBox>
    <telerik:RadTreeView ID="SiteNavigation" Visible="false"......................./>

    WebService

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using Telerik.Web.UI;
    using System.Collections;
    using Telerik.Cms;
    using System.Web.UI.WebControls;
     
    /// <summary>
    /// Summary description for RadComboBoxWebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    [System.Web.Script.Services.ScriptService]
    public class RadComboBoxWebService : System.Web.Services.WebService
    {
     
        public RadComboBoxWebService()
        {
            //Uncomment the following line if using designed components
            //InitializeComponent();
        }
     
        [WebMethod]
        public List<RadComboBoxData> GetCmsPages(object context)
        {
            List<RadComboBoxData> result = new List<RadComboBoxData>();
            foreach (ICmsPage page in GetAllPages())
            {
                RadComboBoxData itemData = new RadComboBoxData();
                itemData.Text = "<a href='" + "http://host/sitefinity/admin/pages.aspx?select=" + page.ID + "'>" + page.MenuName + "</a>";
                itemData.Value = page.MenuName;
                result.Add(itemData);
            }
            return result;
        }
         
        [WebMethod]
        public IList GetAllPages()
        {
            var manager = new CmsManager();
            IList allpages = manager.GetPages();
            return allpages;
        }
     
    }


    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.
  11. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    08 Jun 2010
    Link to this post
    Hey Ivan,

    Unfortunately I get the following error when completing your update:

    "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property."

    Is there anyway to have the RadComboBox only contain Page Groups, and when selected it will filter the AllPagesList.ascx grid with only pages under that Page Group?

    Thanks
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Jun 2010
    Link to this post
    Hi mcpdinkansas,

    This is a general ASP.NET error. My code gets all pages and bind them in a single list no matter of the level. You can check whether the page parenID is GuidEmpty and add only these items to the list  instead of adding all pages. By doing so you will bind only the root level items. You can also bind a RadTreeView  control by using web service, so that this will not change the appearance of the backend.

    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.
  13. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    08 Jun 2010
    Link to this post
    We have a similar issue with our site.  A work around we found handy was the "edit this page" control.  With this control a user can navigate to the page through the live site, instead of using the treeview.  Check out the blog post below for more details:
    http://www.sitefinity.com/blogs/ivan/posts/07-12-17/tip_create_%e2%80%9eedit_this_page%e2%80%9c_link_and_edit_page_without_accessing_administrative_area.aspx 

    Let me know if you find a better work around!

    J
  14. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    08 Jun 2010
    Link to this post
    Is there anyway I can change the functionality of the current Site Map TreeView? I am wondering if I can update this control to use Web Services and only load the Nodes Sub-Pages when the node is clicked? Load on demand.

    Thanks
  15. mcpdinkansas
    mcpdinkansas avatar
    102 posts
    Registered:
    22 Mar 2007
    08 Jun 2010
    Link to this post
    Thanks for the tip Jason, this will definitely be a great addition to the site.

    It looks like no custom solutions can be implemented. I have updated the RadTreeView on the SiteMapPanel.ascx control as follows:

    <telerik:RadTreeView ID="SiteNavigation" runat="server" EnableEmbeddedSkins="false" Skin="SitefinitySiteMap" EnableDragAndDropBetweenNodes="true" PersistLoadOnDemandNodes="false" EnableViewState="false" ExpandAnimation-Type="None" ExpandAnimation-Duration="0" CollapseAnimation-Type="None" CollapseAnimation-Duration="0" Width="190">
    </telerik:RadTreeView>

    I don't know if this has done any help but reading through Telerik's guide for TreeView performance I noted they suggested PersistLoadOnDemandNodes="false" EnableViewState="false"

    I will keep posting if I find any other solutions.
  16. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    09 Jun 2010
    Link to this post
    Ivan - Is there a way to set AllowFilteringByColumn="True" in the GridView1 on \Sitefinity\Admin\ControlTemplates\Pages\AllPagesList.ascx?  This would make finding pages much easier when the sitemap treeview is disabled.  I tried doing this, but the filter boxes don't appear.

    J
  17. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Jason M,

    The control that is used inside AllPagesList.ascx is GridView control which does not have property called - AllowFilteringByColumn. This is a property of RadGrid control. By the way since version 3.7 there is a built-in search for pages that you can use with this purpose.

    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.
  18. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    10 Jun 2010
    Link to this post
    Aha.  Sorry, I assumed you were using the Telerik RadGrid!

    We recently converted our site from 3.2 SP1 to 3.7 SP3 and this search doesn't work really well.  If I search for "networks" (which has 1100+ pages) and select "URL" I don't get any results.  Is there a special way to search by URL?

    I tested this on your demo site, but noticed the search box isn't enable.  This site also appears to be using an older version (3.7.2022.1) of Sitefinity.

    J
  19. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Jason M,

    This feature is introduced in Sitefinity SP3. the syntax for url is "~/path to your page". For instance if you have a page called "AboutUs" which url is ~/AboutUs.aspx  ( host.com/AboutUs.aspx) and you search for ~/AboutUs.aspx you should see the correct results in the GridView.
    I attached a sample video.

    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.
  20. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    10 Jun 2010
    Link to this post
    Ok.  I was hoping I could just put in "/networks/crc/" and return all the sub pages.  The current search will just return one record.  I also think using "~/path/" would also be too confusing for some of our content editors.

    Sorry, not trying to hijack the post.  Just trying to point out that navigation would be really cumbersome if you disable the treeview.

    Thanks for you help!
    J
  21. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Jason M,

    If  you add RadTreeView that is bound through web service I do not believe that there will be a problem. I have implemented this with 1000 child nodes in a root node and the response is less than a second.  Having 2000 child nodes in a single node is not a case of a website navigation.  Currently, the RadTreeView is bound with Server Side Callback  which. Generally these are the capabilities of the control if you use Server Side Callback

    below is the web service code

    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Collections;
    using Telerik.Web.UI;
    using Telerik.Cms;
      
    /// <summary>
    /// Summary description for RadTreeViewWebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    [System.Web.Script.Services.ScriptService]
    public class RadTreeViewWebService : System.Web.Services.WebService
    {
      
        public RadTreeViewWebService()
        {
      
            //Uncomment the following line if using designed components
            //InitializeComponent();
        }
      
        [WebMethod]
        public IList GetRadTreeNodes(RadTreeNodeData node, object context)
        {
            Guid parentId = Guid.Empty;
            if (!node.Value.Equals("0"))
                parentId = new Guid(node.Value);
      
            List<RadTreeNodeData> result = new List<RadTreeNodeData>();
            IList<ICmsPage> pages = GetPages(parentId);
      
            foreach (ICmsPage page in pages)
            {
                RadTreeNodeData nodeData = new RadTreeNodeData();
                nodeData.Text = "<a href='" + "http://host/sitefinity/admin/pages.aspx?select=" + page.ID + "'>" + page.MenuName + "</a>";
                nodeData.Value = page.ID.ToString();
                nodeData.ExpandMode = (page.Pages != null && (page.Pages.Count > 0)) ? TreeNodeExpandMode.WebService : TreeNodeExpandMode.ClientSide;
                result.Add(nodeData);
            }
         
            return result;
        }
      
        [WebMethod]
        public IList<ICmsPage> GetPages(Guid parentId)
        {
            IList<ICmsPage> listofCmsPages = new List<ICmsPage>();
            var manager = new CmsManager();
            IList allpages = manager.GetPages(parentId);
            foreach (ICmsPage p in allpages)
            {
                listofCmsPages.Add(p);
            }
            return listofCmsPages;
        }
    }


    Best wishes,
    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.
  22. John
    John avatar
    22 posts
    Registered:
    21 Jun 2010
    08 Jul 2010
    Link to this post
    I successfully implemented the RadComboBox with the WebService databinding, but unfortunately it is still not a good solution.  Here are the problems with it:
    1) It takes a long time once the user clicks on the control and the webservice databinding occurs.  This is not really a surprise - if you are asynchronously binding many thousands of records to a dropdown control, one would expect it to have poor performance.  In a way, the performance hit is being moved from the page load to when the user clicks on the control.  Performance is better, but still a major problem - in our case unusable.
    2) Loss of granular security on the pages in the list.
    3) If you have same or similar page names, they show up as such in the list.  I tweaked my list to show the full menu path + page name for each page, but this led to formatting issues.

    For the record, the "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property." mentioned previously (which I also got) basically means "your ajax call is returning too much data", which we already knew...But the solution is to put this:
          <webServices>
            <jsonSerialization maxJsonLength="2147483644"></jsonSerialization>
          </webServices>
    in your web config's system.web.extensions -> scripting section.  (2147483644 represents the max integer supported). But again, it's still not a good solution, at least in our situation.
  23. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Jul 2010
    Link to this post
    Hi John,

    Use RadTreeView option which was also shown above -RadTreeViewWebService . The RadComboBox will bind all items unless you use it with a template. You can find more information at RadTreeView for ASP.NET AJAX. Here is  a demo. Using the web service above for RadTreeView you should be able to load 1000 nodes without problems. I have tested with 1000 nodes and the RadTreeView node was expanded form less than a second.

    Sincerely yours,
    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
  24. John
    John avatar
    22 posts
    Registered:
    21 Jun 2010
    08 Jul 2010
    Link to this post
    Ivan.  In the SiteMapPanel.ascx file, if I have any sort of <telerik:RadTreeView ID="SiteNavigation"> control, even one as simple as just <telerik:RadTreeView ID="SiteNavigation" runat="server" /> and nothing else, the page loops through all page groups and calls a SQL proc for each group, which is the cause of this page slowness.  Even if I make that control not visible, this still occurs.  So there's compiled code causing this that I can't get to.  If I try to trick it and call the control something else ("SiteNavigation2"), the page throws up an error "A required control was not found in the template for ''.  The control must be assignable form type "Telerik.Web.UI.RadTreeView" and must have ID "SiteNavigation".  Are you saying that if I implement the webservice RadTreeView binding of this SiteNavigation control, that overrides the inefficient database call?  If so, can you please post the ascx code (I have the webservice working, but the ascx RadTreeView code I don't see anywhere in the above thread - as mcpdinkansas mentions, his doesn't work).
  25. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Jul 2010
    Link to this post
    Hi John,

    It seems that there is some post looping here. On Jun 24, 2010 here - Slow load time for admin Pages.aspx - DB design?  I sent a reply to you where I explained how to remove the control and stop the queries to the database.

    Even setting the control Visible property to False there are some calls. You could completely remove the SiteMapPanel control from Sitefinity\Admin\Pages.aspx ( and references from the code behind) which will stop the database queries. You could implement a custom control that will replace the default SiteMapPanel and use the RadTreeView control that is bound through web service as shown in the another forum post.

    Best wishes,
    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
  26. John
    John avatar
    22 posts
    Registered:
    21 Jun 2010
    09 Jul 2010
    Link to this post
    Ivan, sorry about the duplicate threads.  I put a note in the other one (which is essentially a duplicate) that the conversation has moved here.  Just wanted all the notes in one place, for future researchers.

    Anyways, we figured awhile ago that page performance wasn't viable with the existing SiteNavigation RadTreeView control due to the looping database calls in the inaccessible compiled code, so we've already implemented a custom control.  And it works great, but it appears there's interaction with other controls in the pages.aspx page that prevents normal functionality.  We'd like to know if there's a way around this.

    So in Sitefinity/Admin/Pages.aspx we replaced the SiteMapPanel Control with: <uc:SiteMapTreeCustom ID="siteMap" runat="server" />
    Here's our control:
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="SiteMapTreeCustom.ascx.cs" Inherits="Sitefinity_Admin_ControlTemplates_Pages_SiteMapTreeCustom" %>
    <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
    <%@ Register Namespace="Telerik.Cms.Web.UI" Assembly="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %>
     
    <asp:LinkButton ID="createBtn" CommandName="New" CssClass="CmsButLeft new" runat="server">
        <strong class="CmsButRight light"><asp:Literal ID="Literal1" runat="server" Text="Create a Page"></asp:Literal></strong>
    </asp:LinkButton>
    <h2 id="sitemap"><asp:Literal ID="Literal2" runat="server" Text="Site Map"></asp:Literal></h2>
    <div class="sitemapTree">
        <telerik:RadTreeView ID="rtSiteMap" runat="server" DataSourceID="XMLDataSource" OnNodeDataBound="rtSiteMap_TreeNodeDataBound" EnableViewState="false" />
        <asp:XmlDataSource ID="XMLDataSource" runat="server" />
    </div>

    And here's the codebehind:
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    using Telerik.Web.UI;
    using Telerik.Cms;
    using Telerik.Cms.Web.UI;
     
    public partial class Sitefinity_Admin_ControlTemplates_Pages_SiteMapTreeCustom : System.Web.UI.UserControl
    {
        Guid _SelectedPageID;
     
        #region Properties
     
        public Guid SelectedPageID
        {
            get { return _SelectedPageID; }
            set { _SelectedPageID = value; }
        }
     
        #endregion
     
        protected void Page_Load(object sender, EventArgs e)
        {
     
            string str_username = Telerik.Security.SecurityManager.GetCurrentUserName();
            string strXML = // custom call to get the xml tree data from the database
     
            RadTreeNodeBinding tbn1 = new RadTreeNodeBinding();
            tbn1.DataMember = "ROOT";
            tbn1.TextField = "Name";
            rtSiteMap.DataBindings.Add(tbn1);
     
            RadTreeNodeBinding tbn2 = new RadTreeNodeBinding();
            tbn2.DataMember = "PARENT";
            tbn2.TextField = "Name";
            tbn2.ValueField = "ID";
            rtSiteMap.DataBindings.Add(tbn2);
     
            RadTreeNodeBinding tbn3 = new RadTreeNodeBinding();
            tbn3.DataMember = "NODE1";
            tbn3.TextField = "Name";
            tbn3.ValueField = "ID";
            rtSiteMap.DataBindings.Add(tbn3);
     
            RadTreeNodeBinding tbn4 = new RadTreeNodeBinding();
            tbn4.DataMember = "NODE2";
            tbn4.TextField = "Name";
            tbn4.ValueField = "ID";
            rtSiteMap.DataBindings.Add(tbn4);
     
            XMLDataSource.Data = strXML;
            rtSiteMap.DataBind();
            rtSiteMap.CollapseAllNodes();
            rtSiteMap.Nodes[0].Expanded = true;
        }
     
        protected void rtSiteMap_TreeNodeDataBound(object sender, RadTreeNodeEventArgs e)
        {
            if (e.Node.Value != "All Pages")
            {
                e.Node.NavigateUrl = "~/Sitefinity/Admin/Pages.aspx?select=" + e.Node.Value;
            }
            else
            {
                e.Node.Value = Guid.Empty.ToString();
            }
     
            if (e.Node.Value == this.SelectedPageID.ToString().ToUpper())
            {
                e.Node.Selected = true;
            }
        }
    }

    As you can see, we bound the tree through a straight SQL call.  We kindof cheated in that we know we will only have 3 nested levels in our siteMap, so we were able to assume as such when binding.  We wrapped the request/response into a single DB call with the user as a parameter, instead of looping through each page group and making a separate call on each (Sitefinity!).  As we got into the database, we did see how it was tricky with the current architecture to wrap these into a single call, but it's certainly doable.  Anyways, it works great, looks just like the normal pages.aspx page but much faster.  Here's the problem:
    When we go to the Properties or Permissions in the Grid and Save Changes, we get this error:
    Unable to cast object of type 'ASP.sitefinity_admin_controltemplates_pages_sitemaptreecustom_ascx' to type 'Telerik.Cms.Web.UI.SiteMapPanel'.
    Also, the Create a Page button doesn't work either.  I guess there's some kind of interaction between the SiteMapPanel and other controls on the page?  Is there a way around this?  Calling our custom control a type of telerik:SiteMapPanel doesn't seem to work, because the compiled code for that control requires the inefficient SiteNavigation RadTreeView to exist...

    Appreciate all your help.
  27. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Jul 2010
    Link to this post
    Hello John,

    You need to create a class that inherits (in App_Code or separate class library) from SiteMapPanel and replace the default control inside Sitefinity\Admin\Pages.aspx. Currently you are trying to cast your user control.

    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
  28. John
    John avatar
    22 posts
    Registered:
    21 Jun 2010
    13 Jul 2010
    Link to this post
    Ivan,  I have created a class in App_Code directory that inherits from SiteMapPanel.  This may be a silly question, but what do you "replace the default control inside Sitefinity\Admin\Pages.aspx" with?  When you create a ascx control, you can't have it inherit from the custom class without (unsuccessfully) attempting to cast it as your custom class.  How does one tie front-end GUI aspx/ascx code to the custom class?

    Appreciate all your help.
  29. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Jul 2010
    Link to this post
    Hi John,

    Inside Sitefinity\Admin\Pages.aspx there is a control of type SiteMapPanel that you need to replace with the custom one like shown below

    <%@ Page Language="C#" MasterPageFile="~/Sitefinity/Admin/Admin.master" AutoEventWireup="true" CodeFile="Pages.aspx.cs" Inherits="Admin_Pages" Title="Untitled Page" %>
    <%@ Register Assembly="Telerik.Cms" Namespace="Telerik.Cms.Web.UI" TagPrefix="cc1" %>
    <%@ Register Assembly="App_Code" Namespace="test"  TagPrefix="cc2" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <div id="main">
            <div class="in">
                <cc1:PageEditor ID="pageEditor" runat="server"></cc1:PageEditor>      
            </div>
        </div>
        <div id="subnav">
            <div class="in">
            <cc2:SiteMapCustom runat="server" ID="siteMap" PageEditorID="pageEditor" />
                <%--<cc1:SiteMapPanel ID="siteMap" PageEditorID="pageEditor" runat="server" />--%>
            </div>
        </div>
        <div class="clear width"><!-- --></div>
    </asp:Content>

    where SiteMapCustom inherits from SiteMapPanel

    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
  30. John
    John avatar
    22 posts
    Registered:
    21 Jun 2010
    13 Jul 2010
    Link to this post
    Okay, so we've successfully implemented a custom class that inherits SiteMapPanel.  And we can use this custom class to add our own RadTree and do whatever we want with it, including a more efficient data get and bind, whether through straight database call, webservice call, or whatever.  But in terms of getting performance better, we're right back to where we started in the "other" thread - This custom object, since it inherits from SiteMapPanel, still references compiled code which requires the RadTreeView:SiteNavigation control in the SiteMapPanel.ascx to exist, or else you get this error: Telerik.Cms.Web.UI.TemplateException: A required control was not found in the template for "". The control must be assignable form type "Telerik.Web.UI.RadTreeView" and must have ID "SiteNavigation".
    And as soon as you do include this RadTreeView:SiteNavigation control, the compiled code does the inefficient call.  Ivan, is there a method in the SiteMapPanel class I can override that'll help out?  I really appreciate all your help - you guys have very good support - but I'm beginning to agree with mcpdinkansas - a custom solution isn't feasible here, at least within the context of the interconnected controls of the Pages.aspx page.
Register for webinar
31 posts, 0 answered
1 2