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

Thread: asp.menu datasource fileters

  1. #1
    davlun is offline Member
    Join Date
    Apr 2010
    Posts
    36

    Default asp.menu datasource fileters

    Hello,

    I have tried using some of the standard asp.net menu filters for data source like:
    C#/VB.NET Code:
    ds.ShowStartingNode false;
    ds.StartingNodeUrl "~/default.aspx"
    and also tried
    C#/VB.NET Code:
    ds.StartingNodeOffset 1
    In the ds setup in templatebase.cs for the menu data source. I have also tried using the offset and some other filters, but none seem to have any impact on the output.

    Are these options available? Or maybe I am using them incorrectly?

    Dave

  2. #2
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    what are you trying to do exactly?
    AspDotNetStorefront
    Shopping Cart

  3. #3
    davlun is offline Member
    Join Date
    Apr 2010
    Posts
    36

    Default

    A couple of things actually, each one kind of helping the other,but really distinct.

    First I noticed that the styles are a little convoluted for the menu since it all has to reside under a parent element, in the standard install 'home'. I am guessing this is to preserve compatibility with your old templating system, but cant say for certain. So I was going to wrap the menu in 'dummy' element to preserve your requirements for code and shift starting point for menus down one level. Then styles could be consistent all the way down and easier to work with.

    Second, I want to put the Categories horizontally across the top of the menu. I have already removed all of the extra pieces I dont want there (departments, manufacturers, etc) but still havent found how to tell the menus to be rendered horizontally. I found some old posts that seemeed to have the answers but appears that is for the older versions of adnsf.

    Let me know if this doesnt give you enough detail,

    David

  4. #4
    davlun is offline Member
    Join Date
    Apr 2010
    Posts
    36

    Default

    Bump... bump

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

    Default

    In the master.template CodeBehind file you could write a routine that will modify the menu after it has been created. I did something simular to that in http://forums.aspdotnetstorefront.co...ad.php?t=22665

  6. #6
    davlun is offline Member
    Join Date
    Apr 2010
    Posts
    36

    Default

    I actually saw your post already in looking for peoples updates/improvements to the new masterpages.

    However, this was a feature that was readily available in older versions and a lot of people used and are asking about now, so it seems there really should be a way to do this already, it just hasn't been noted yet.

    I am hoping someone on staff will provide the answer so I and others with the same question posted recenlty can get the official tweak needed to work under v9.

    I have already built the menu's statically, but that is not really a long term answer.

    Your idea for the cookies and such was a nice one. I was wondering if you could tie into the begin request feature in global.asax to set a session variable for this and other types of things.

    Regards,

    Dave

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

    Default

    My idea was that when you are advertising your site advertise it as http://myURL/dept/ instead of just http://myURL/. This way the cookie is set the first time they go to the page.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

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

    Default

    Here is some code that will fix the main menu so that even though is is automatically generated by page.menu.xml.config it can have multiple first-level menus.

    Code:
    Private Sub FlattenAutoMenu()
    	If aspnetMenu IsNot Nothing Then
    		Do While aspnetMenu.Items(0).ChildItems.Count > 0
    			aspnetMenu.Items.Add(aspnetMenu.Items(0).ChildItems(0))
    		Loop
    		aspnetMenu.Items.RemoveAt(0)
    	End If
    End Sub
    Put a call to this right after the call to SetupMenu in the OnPreRender Sub.

    Basically this will remove the single first level item and make all the second level items first level items.
    Last edited by cjbarth; 05-17-2010 at 06:39 AM.
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM

  9. #9
    chazandchaz is offline Member
    Join Date
    Jul 2006
    Posts
    70

    Default

    I converted your VB code to C#. It seems to make all elements root elements or level 1 elements. All the drop downs are shown as actually root menu items.

    Here is the code I used:

    Code:
    private void FlattenAutoMenu()
       {
           if (aspnetMenu != null) {
               while (aspnetMenu.Items[0].ChildItems.Count > 0) {
                   aspnetMenu.Items.Add(aspnetMenu.Items[0].ChildItems[0]);
               }
                aspnetMenu.Items.RemoveAt(0);
            }
        }
    I also posted a question related to what I am actually try to do here: http://forums.aspdotnetstorefront.co...ad.php?p=88642

    Any tips to get this to work would be greatly appreciated.

    Chaz.

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

    Default

    That code will remove 'Home' (level 0) and replace it with all the level 1 items. Or, put another way, it will lower all the levels by 1.

    If you want to add another level 0 item you can just use the Items.Add function.

    You can see me doing this at the bottom of this post under the subheading Modify Menu:

    http://forums.aspdotnetstorefront.co...ad.php?p=88131
    ML9.3.1.1
    SQL 2012 Express
    VS 2010
    Azure VM