Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 7 of 7

Thread: master pages

  1. #1
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default master pages

    I watched the webinar about controls and followed their idea of having multiple master pages. I have everything working fine and content loading just fine. I'm working on creating a category xml package to show the current category and it's sub categories when you are viewing showcategory.aspx. Unfortunately, it doesn't seem like any runtime information is being output for the xml package to access. One of the major things being querystring information.

    I am including the xml package in my category.master file this way:

    Code:
    <asp:Literal ID="navigation" runat="server" Text="<%$ Tokens:XmlPackage, categories.nav.xml.config%>" />
    Has anyone else done this? Any suggestions on a fix?
    Last edited by chrismartz; 07-26-2011 at 10:11 AM.

  2. #2
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi

    Is this v8 or v9?
    QueryString info should be coming across into the XmlPackage because I know we use the QueryString info within category pages to allow the user to change the sort order of results and of course to move between pages.

    Can you give us an example of a page with the problem?

  3. #3
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    This is for V9. I did not have this issue prior to breaking the templates out into multiple templates. I have root.master which has all the main layout, and then category.master which has the category page layout.

    Code:
    <%@ Master Language="C#" AutoEventWireup="true" Inherits="AspDotNetStorefront.MasterPageBase" MasterPageFile="~/App_Templates/Skin_1/root.master"%>
    <%@ Register TagPrefix="aspdnsfc" Namespace="AspDotNetStorefrontControls" Assembly="AspDotNetStorefrontControls" %>
    <%@ Import Namespace="AspDotNetStorefrontCore" %>
    
    <asp:Content ID="templateContent" runat="server" ContentPlaceHolderID="RootContent">
        <div id="twoColumnWrap">
            <div id="content">
                <div id="breadcrumbcontent"><div><a href="~/" class="home" runat="server">Home</a><asp:Literal ID="SectionTitle" runat="server" /></div></div>
                <div class="post">
                    <asp:ContentPlaceHolder ID="PageContent" runat="server"></asp:ContentPlaceHolder>
                </div>
            </div>
            <div id="leftWrap">
                <asp:Literal ID="navigation" runat="server" Text="<%$ Tokens:XmlPackage, categories.nav.xml.config%>" />
            </div>
            <div style="clear:both;"></div>
        </div>
    </asp:Content>
    When I look at the runtime xml, category id is nowhere to be found.

  4. #4
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi

    Based on your description, I have just created a similar site following the method you've described and you are right, the runtime entity info, such as CategoryID isn't passed into other XmlPackages being run as part of the template.

    I think this is because ShowCategory.aspx.cs is using the ShowEntityPage class to render its content and ShowEntityPage adds the additional runtime params.

    Two ways I can think of to solve this:

    Modify ShowCategory.aspx.cs so that it also takes control of rendering your categories.nav.xml.config package and passes it the correct runtime param for CatID.

    Or, write a really small XsltExtension that sits within categories.nav.xml.config to return the correct categoryid based on the page URL (this is how we've approached this type of thing before)

    Adam

  5. #5
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I moved my navigation function into the xml package and all is working fine. Thanks for the tip!

  6. #6
    tito is offline Senior Member
    Join Date
    Sep 2005
    Posts
    213

    Default

    Hi chrismartz
    When you have the time, can you show how you placed the left navigation into the xml package. I personally would like to place the left menu into the Entity Grid with Prices.
    Thank you for your time..

    G
    Gordon

    8.1.1

  7. #7
    gcreed is offline Junior Member
    Join Date
    Aug 2008
    Posts
    4

    Thumbs up Another Solution for Tokens missing RunTimeParameters

    seo: /root/System/PageName, /root/QueryString/categoryId -> are empty, blank, null, missing

    I banged my head for entirely too long on this, so I'm contributing/affirming. In short, if you're invoking your XMLPackage from your master template via a Token call, none of the necessary parameters are passed to the package.

    webopius is right:
    I think this is because ShowCategory.aspx.cs is using the ShowEntityPage class to render its content and ShowEntityPage adds the additional runtime params.
    He suggested two great ways to fix this, but I wanted to keep my primary nav in the master page (rather than moving to ShowXXXXX.aspx.cs) and I wanted my solution to work for all entity types. I also didn't want to replicate the RunTimeParms buildup that's already handled in the ShowEntityPage (see line 251) by adding my own XsltExtension (though an elegant solution and probably best for source-code parity).

    Instead, (b/c I had the source), I simply made the RunTimeParms a public property of the master page and pass it all the back up from the ShowEntityPage...
    Code:
     
    RunTimeParms = String.Format("EntityName={0}&EntityID={1}", m_EntitySpecs.m_EntityName, m_EntityInstanceID.ToString());
    
    RunTimeParms += String.Format("&CatID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_CategoryFilterID.ToString()));
    RunTimeParms += String.Format("&SecID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("SECTION", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_SectionFilterID.ToString()));
    RunTimeParms += String.Format("&ManID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("MANUFACTURER", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_ManufacturerFilterID.ToString()));
    RunTimeParms += String.Format("&DistID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("DISTRIBUTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_DistributorFilterID.ToString()));
    RunTimeParms += String.Format("&GenreID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("GENRE", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_GenreFilterID.ToString()));
    RunTimeParms += String.Format("&VectorID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("VECTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_VectorFilterID.ToString()));
    RunTimeParms += String.Format("&ProductTypeFilterID={0}", m_ProductTypeFilterID.ToString());
    
    if(sender.GetType().BaseType.BaseType == typeof(SkinBase))
          ((MasterPageBase)((SkinBase)sender).Master).RunTimeParms = RunTimeParms;

    which can then be passed back down to any Token-invoked packages that need it...
    Code:
    string expression = string.Format("{0},{1},{2}", "XMLPACKAGE", "rev.departments.xml.config", RunTimeParms);
          litSectionNav.Text = Tokens.GetEvalData(expression, this.GetType(), string.Empty).ToString();
    BUT, I'm pretty new to ASPDNSF, so please correct me is this seem ill-guided.

    However, it's super-handy in this case where I might also want to pass this data up from other pages. For example, if I'm on a product page (ShowProduct.aspx) where there is no entity info, I might want my nav to recall which entity I came from and keep that section/category expanded, so I can do this...
    Code:
    ((MasterPageBase)this.Master).RunTimeParms = String.Format("EntityName={0}&EntityID={1}", SourceEntity, SourceEntityID);
    Last edited by gcreed; 03-22-2012 at 11:03 PM.