cancel
Showing results for 
Search instead for 
Did you mean: 

Help with plug in - categoriestree

Former Member
0 Kudos

I want to use a plug in called categoriestree.ascx. By default the tree is expanded to show all levels. I want to show the tree collapsed by default.

I tried to modify treemenu.ascx by adding treemenu.CollapseAll. It doesn't work. How can I collapse a tree by default?

My code:

void Page_Load(object sender, System.EventArgs e)

{

NPBasePage bp = ((NPBasePage)Page);

if (!Page.IsPostBack)

{

treemenu.LinkBase = bp.VirtualPath;

treemenu.DataSource = NPCatalogCategory.GetCategoriesDataSet(bp.Catalog.CatalogID);

treemenu.DataBind();

treemenu.CollapseAll();

}

}

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Derek,

I'm using 2007.

I can get some control of the tree by using Java.

This is the code for ztreemenu.ascx page

<input type="hidden" name="JSFPostBack" />

<scri pt language=javascript>

var nodeTemp;

function TreeView1_onLoad(sender, args)

{

sender.CollapseAll();

}

</scri pt>

<%@ Control Language="c#" Inherits="netpoint.common.controls.treemenu" Codebehind="treemenu.ascx.cs" %>

<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>

<ComponentArt:TreeView id="tvList" ClientScriptLocation="~/scripts" KeyboardEnabled="false"

DragAndDropEnabled="false"

NodeEditingEnabled="false"

CssClass="TreeView"

NodeCssClass="TreeNode"

SelectedNodeCssClass="SelectedTreeNode"

HoverNodeCssClass="HoverTreeNode"

NodeEditCssClass="NodeEdit"

LineImageWidth="19"

LineImageHeight="20"

DefaultImageWidth="16"

DefaultImageHeight="16"

ItemSpacing="0"

ImagesBaseUrl="~/assets/common/tree/"

NodeLabelPadding="3"

ParentNodeImageUrl=""

LeafNodeImageUrl=""

ShowLines="true"

LineImagesFolderUrl="~/assets/common/tree/zlines/"

EnableViewState="true"

ExpandNodeOnSelect="false"

runat="server" >

<clientevents>

<Load eventhandler="TreeView1_onLoad" />

</clientevents>

</ComponentArt:TreeView>

Former Member
0 Kudos

Can that default behavior be changed in 2007?

Also related to the categoriestree plugin,

- How difficult would it be to have it go to the parent category when they click on it rather than just expand the tree?

- What about having the cursor change to a clickable link when you mouse over the tree, rather than a text selector?

Derek

Former Member
0 Kudos

Hi Thomas,

I do not think you will be able to modify that control in 5.9, as the page_load is implemented in the codebehind.

Try copying the .ascx and renaming it.

The current page_load code is as follows:



    void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            treemenu.LinkBase = ((NPBasePage)base.Page).VirtualPath;
            treemenu.DataSource = netpoint.classes.MenuItem.GetMenuItemsDataSet(MenuCode.Text);
            treemenu.DataBind();
        }
    }