I needed to add a populate on demand treeview to a div because the normal treeview was taking a very long time to get loaded. This is what I did.

public System.Web.UI.WebControls.TreeView tvGeoScope = new System.Web.UI.WebControls.TreeView();
string strCountry =”Country”;
tvGeoScope.ID =”tvGeoScope”;
//gets called whenever a node is clicked to expand.
tvGeoScope.TreeNodePopulate += new TreeNodeEventHandler
(tvGeoScope_TreeNodePopulate);
TreeNode n2 = new TreeNode(strCountry, strCountry);
n2.Expanded = false;
n2.SelectAction = TreeNodeSelectAction.None;
n2.PopulateOnDemand = true;
n2.ShowCheckBox = false;

To get a more detailed explaination, click on the link where I have given more explainations http://www.dotnetspider.com/resources/20921-Get-populate-demand-treeview-asp-net.aspx

Advertisements