More in this section

Forums / Developing with Sitefinity / Add/Edit/Consume Custom Sitemap Attributes

Add/Edit/Consume Custom Sitemap Attributes

3 posts, 0 answered
  1. Steve
    Steve avatar
    1 posts
    Registered:
    04 May 2009
    09 Feb 2010
    Link to this post
    I am trying to determine a way to add and edit custom sitemap attributes for pages/groups. I'm converting an already-developed .Net site over to Sitefinity, and in that site, I have a menu control (basically, a repeater that hits SiteMapDataSource for what it needs) that looks at some attributes in the web.sitemap that I've added. One such attribute is CssClass, as each root node of the menu has a specific CssClass due to the background images I am using in the menu. For example, one such node looks like this:

    <siteMapNode url="~/about/default.aspx" title="About" CssClass="menu-about" Columns="3" description="About [Company Name Redacted]">
       <!--Child Nodes -->
    </siteMapNode>

    In my code behind, on databinding, I access the CssClass attribute by using something along the lines of:

    string cssClass = node["CssClass"];

    Is there any way for me to extend the controls in Page Creating/Editing to include custom attributes such as this, as well as extend other controls to read these custom sitemap attributes?

    Thanks for any help you toss my way :-)
  2. Martin Meixger
    Martin Meixger avatar
    7 posts
    Registered:
    27 Sep 2009
    15 Feb 2010
    Link to this post
    Based on the instrucions in this article, i have extended my Sitefinity\Admin\ControlTemplates\Pages\PagePropertiesEdit.ascx.cs witch does the admin ui for page editing.

    Basically, i intercept Page Edit, look for the (GUID)PageId, and use it for displaying/storing/loading the data of my custom attribute controls to my database.

    Also, for accessing the attributes in your template or usercontrol, you have to use the PageId and load the data from your database.

    from Ivan Dimitrov in http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/extend-page-properties.aspx#737547
    "This functionality will be available after Sitefinity 4.0, which will be released this year."
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    15 Feb 2010
    Link to this post
    Hello Steve,

    1. You can extend the page properties using external data layer.

    2. Create a custom table in the database where you store these values and the retrieve them when your control is bound.

    In both cases you will have some performance issues due to the additional queries you should make to the database to get the correct attribute for each page.

    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.
Register for webinar
3 posts, 0 answered