Infinite Category with Treeview


public void Load_tree()
{
DataSet PrSet = objc.GetAllParents();
TreeView1.Nodes.Clear();
foreach (DataRow dr in PrSet.Tables[0].Rows)
{
if ( Int32.Parse(dr["parent"].ToString()) == 0)
{
TreeNode tnParent = new TreeNode();
tnParent.Text = dr["cat_name"].ToString();
string value = dr["cat_id"].ToString();
tnParent.Expand();
TreeView1.Nodes.Add(tnParent);
FillChild(tnParent, value);
}
}
}

public int FillChild(TreeNode parent, string IID)
{
objc.Cat_Id = Int32.Parse(IID);
DataSet ds = objc.Dataset_GetChild();
if (ds.Tables[0].Rows.Count > 0)
{

foreach (DataRow dr in ds.Tables[0].Rows)
{
TreeNode child = new TreeNode();
child.Text = dr["cat_name"].ToString().Trim();
string temp = dr["cat_id"].ToString();
child.Collapse();
parent.ChildNodes.Add(child);
FillChild(child, temp);
}
return 0;
}
else
{
return 0;
}

}