mas_oz2k1
mas_oz2k1

Reputation: 2901

Asp.net TreeView control - maximum number of nodes

I have a treeView control in ASP.NET page that will be loaded with up to 12,000 nodes in different levels. For example:

According to this link:

http://msdn.microsoft.com/en-us/library/ms529261.aspx

the node limit is 1000. Is this correct or is it dependent on available memory(please specify value)?

Assuming it is correct. is there any way to split the 4600 child nodes in say in chunks of 300 hundred? I am thinking that if dummy nodes are used (previous /next navigation) to navigate the chunks will easy the load of the html page.

Sample code in C# will be greatly appreciated. (Or VB.NET if you can not translate it to C#)

Upvotes: 0

Views: 3628

Answers (4)

mas_oz2k1
mas_oz2k1

Reputation: 2901

At the end , we use Obout treeview because it does not have the limitations of the asp.net treeview stated on my question, plus I can load 1000s of nodes with no problems and its virtual loading feature is great.

Upvotes: 0

ram
ram

Reputation: 11

TreeNode node;
node = new TreeNode(Session["Type"].ToString(), Session["Type"].ToString(), "", "Sub_cat.aspx?MainCat=" + Session["Type"].ToString(), "");
node.SelectAction = TreeNodeSelectAction.SelectExpand;
TreeView1.Nodes.Add(node);
string str1 = "select * from sub_cat where main_cat='"+Session["Type"].ToString() +"'"; ///+ node.Text + "'";
dt1 = db.gettable(str1);
for(int x=0;x<dt1.Rows.Count;x++)
{
    //Session["subcat"] = dt1.Rows[x]["sub_cat"].ToString();
    string sub = dt1.Rows[x]["sub_cat"].ToString();
    TreeNode node1 = new TreeNode(dt1.Rows[x]["sub_cat"].ToString(), dt1.Rows[x]["sub_cat"].ToString(), "", "Product_collection.aspx?sub_cat=" + sub, "");
    node1.SelectAction = TreeNodeSelectAction.SelectExpand;
    //TreeView1.Nodes.Add(node1);
    node.ChildNodes.Add(node1);

    string str2 = "select * from product_master where main_cat='" + Session["Type"].ToString() + "' and sub_cat='" + node1.Text + "' order by product_code asc";
    dt2 = db.gettable(str2);
    for(int y=0;y<dt2.Rows.Count;y++)
    {
       // Session["product_code"]=dt2.Rows[y]["product_code"].ToString();
        string code = dt2.Rows[y]["product_code"].ToString();
        TreeNode node2 = new TreeNode(dt2.Rows[y]["product_code"].ToString(), dt2.Rows[y]["product_code"].ToString(), "", "prod_desc.aspx?product_code=" + code, "");
        node2.SelectAction= TreeNodeSelectAction.SelectExpand;
        node1.ChildNodes.Add(node2);
    }
}

Upvotes: 1

Davide Piras
Davide Piras

Reputation: 44605

You should not load more than the visible nodes at once, when user expands a node level you can/could/should/must use load on demand to load the children and so on recursively only when needed.

Do not overload the page rendering loading all nodes, makes no sense.

search for load on demand asp.net treeview and similar...

Upvotes: 0

Ravi Vanapalli
Ravi Vanapalli

Reputation: 9942

Yes this is true I have checked it practically after reading this link http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/dcacb090-73a2-4845-ab19-e280ea373ffb

Upvotes: 0

Related Questions