Hi. I have decided to use the adapted Treeview control for a project I am working on at the moment. All the control will do is display lists of categories and sub categories, and eventually products at the bottom level. When I load my page up, everything
is displayed, rather than the top level nodes. I have taken the control out and placed it in a small test project and exactly the same thing is happening. I am not using the App_Themes folder, I am linking directly to the CSS and Javascript files, and my CSS
Treeview Adapter is in it's own .dll file. My code is below. If anyone could give me some pointers and help me out that would be great. I am using C#.
namespace CSSAdaptersTest
{
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Mando.Platform.ECommerce.ProductManagement;
using Mando.Platform.ECommerce.StoreManagement;
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void PopulateNode(object sender, TreeNodeEventArgs e)
{
int categoryID = Convert.ToInt32(e.Node.Value);
Category myRootCategory = new Category(categoryID);
CategoryCollection myCategories = new CategoryCollection(myRootCategory.CategoryID);
if (myCategories.Count > 0)
{
foreach (Category myCategory in myCategories)
{
TreeNode myNode = new TreeNode(myCategory.Name, myCategory.CategoryID.ToString());
myNode.PopulateOnDemand = true;
myNode.SelectAction = TreeNodeSelectAction.Expand;
e.Node.ChildNodes.Add(myNode);
}
}
}
}
}
On my .aspx page, my treeview control is as follows:
I've managed to get the nodes to expand correctly by adding myNode.Expanded = "false" on the inital load, but this had made the list item a URL now. How can I remove this url so I can click the name of the category and have the list expand without posting
back to the server?
None
0 Points
10 Posts
CSS Adapted Treeview control displaying all nodes on page load
Dec 17, 2007 10:26 AM|cmssken1|LINK
Hi. I have decided to use the adapted Treeview control for a project I am working on at the moment. All the control will do is display lists of categories and sub categories, and eventually products at the bottom level. When I load my page up, everything is displayed, rather than the top level nodes. I have taken the control out and placed it in a small test project and exactly the same thing is happening. I am not using the App_Themes folder, I am linking directly to the CSS and Javascript files, and my CSS Treeview Adapter is in it's own .dll file. My code is below. If anyone could give me some pointers and help me out that would be great. I am using C#.
Treeview "css friendly adapter" treeview programmatically populate OnAdaptedSelectedNodeChanged OnSelectedNodeChanged css adapters
None
0 Points
10 Posts
Re: CSS Adapted Treeview control displaying all nodes on page load
Dec 17, 2007 11:09 AM|cmssken1|LINK
I've managed to get the nodes to expand correctly by adding myNode.Expanded = "false" on the inital load, but this had made the list item a URL now. How can I remove this url so I can click the name of the category and have the list expand without posting back to the server?
Participant
1683 Points
479 Posts
Re: CSS Adapted Treeview control displaying all nodes on page load
Jan 02, 2008 03:32 PM|Rinze|LINK
Can't u use the Staticdisplaylevels property of the treeview control? It limits the number of menulevels that are fully expanded
Rinze Cats
---------