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 9 of 9

Thread: Entity Control nav

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

    Default Entity Control nav

    I am using the following line of code to list the categories and subcategories in my aspdnsf site.

    Code:
    <aspdnsf:EntityControl ID="ctrlEntityCategory" runat="server" Header="leftnav" EntityType="Category" MaxMenuSize="<%$ Tokens:AppConfigUSInt, MaxMenuSize %>" />
    Does anyone know how I can limit the categories that show up in that list? I do not want one whole top-level category to ever show when the pages are loaded.

  2. #2
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    Limit based on what factor?
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

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

    Default

    Currently, this will output the following:

    Art
    Projects
    I want it to only show Art. It could be limited based on name or category ID. I just cannot find the sql query that pulls in the categories for this control.

  4. #4
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    In computer speak, how do you know you only want to show Art? Is it because it is the first entry? It starts with an A? Is less than 4 letters? I am looking up the code I used for filtering my categories, but if you just arbitrarily just want to show Art, why do you have the other category at all? You could just hide it or remove it.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

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

    Default

    I would like to limit based on SEName or CategoryID. CategoryID would probably be best. I have a ton more categories and just gave two as an example.

  6. #6
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    So you'd filter based on a query string then?
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

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

    Default

    I have added the following to entitycontrol.cs so that I can do an if statement to show or hide categories based on what is passed.

    Code:
    private const string SHOW_CAT = "ShowCat"; // All = All Categories, Project = Projects, Cat = Categories no Projects

  8. #8
    cjbarth is offline Senior Member
    Join Date
    Oct 2008
    Posts
    392

    Default

    The code I modified is in ASPDNSFCore/ProductMappingLinkItem.vb. That file contains the logic by which items are selected from the database for presentation in the menu. I modified my code to limit to the 10 most populous manufacturers, but you can probably get information form the query string with little effort. Look at about line 460 in GetAllFirstLevel.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

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

    Default

    You could just use an XmlPackage to render these Categories, then you have complete control over what is displayed and what gets filtered.