.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Tree View To Show Main catagories ,Sub catagories ,Subsub catagories ,and Related products With Reu

Posted By: Vasu Hajare     Posted Date: March 21, 2011    Points:5   Category :ASP.Net
Hello sir,

I have an application i which their is a displaying Main catagories >SubCatagories >SubsubCatagories >products ..Like this i have to display the tree view with the help of recursive Function..
I have done some coding but all Products are not binding their related Subcatagories .. Here is a code..

public void load_tree()
DataSet PrSet = PDataset("Select * from categories where idparentcategory =1");
foreach (DataRow dr in PrSet.Tables[0].Rows)
if ((int)dr["idparentcategory"] == 1)
TreeNode tnParent = new TreeNode();
tnParent.Text = dr["categoryDesc"].ToString().Trim();
tnParent.Value = dr["idCategory"].ToString().Trim();
FillChild(tnParent, tnParent.Value);
fillproduct(tnParent, tnParent.Value);


public void FillChild(TreeNode parent, string idCategory)
DataSet ds = PDataset("Select * from categories where idparentcategory =" + idCategory);
int i = 0;
if (ds.Tables[0].Rows.Count > 0)
foreach (DataRow dr in ds.Tables[0].Rows)
TreeNode child = new TreeNode();
child.Text = dr["categoryDesc"].ToString().Trim();
string temp = dr["idCategory"].ToString();
FillChild(parent.ChildNodes[i], temp);
fillproduct(parent.ChildNodes[i], temp);
i = i + 1;
// break;

I want to use recursive function in FillChild() that all sub catagories and their products should display..


No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend