private void AddChilds(string sKeyTemp)
        {
            Button nodebutton;


            Hashtable htselect = new Hashtable();
            DataTable dtselect = new System.Data.DataTable();

            htselect.Add("@Trans", "ALL_ORDER_ALLOCATE");
            // htselect.Add("@Subprocess_id", Subprocess_id);
            dtselect = dataaccess.ExecuteSP("Sp_Orders_Que", htselect);
            DataTable dtchild = new DataTable();

            dtchild = gen.FillChildTable();
            for (int i = 0; i < dtchild.Rows.Count; i++)
            {
                TreeView1.Nodes.Add(dtchild.Rows[i]["User_ID"].ToString(), dtchild.Rows[i]["User_Name"].ToString());
            }
            foreach (TreeNode myNode in TreeView1.Nodes)
            {
                //myNode.BackColor = Color.White;
            }
        }
    private void PopulateTreeview()
    {
        try
        {
            //get data from user
            Hashtable htselect = new Hashtable();
            DataTable dtselect = new System.Data.DataTable();

            //if (Session_OrderType == "Web/Call")
            //{

            //    htselect.Add("@Trans", "INSERT_ALL_USER_ORDERS");

            //}
            //else if (Session_OrderType == "Mail/Fax")
            //{

            //    htselect.Add("@Trans", "INSERT_MAIL_FAX_USER_ORDERS");

            //}
            //else if (Session_OrderType == "QC")
            //{
            //    htselect.Add("@Trans", "INSERT_QC_USER_ORDERS");
            //}
            //else if (Session_OrderType == "Hold")
            //{

            //    htselect.Add("@Trans", "INSERT_HOLD_USER_ORDERS");
            //}
            //else if (Session_OrderType == "Clarification")
            //{

            //    htselect.Add("@Trans", "INSERT_CLARIFICATION_USER_ORDERS");
            //}
            //else if (Session_OrderType == "Cancelled")
            //{

            //    htselect.Add("@Trans", "INSERT_CANCELLED_USER_ORDERS");
            //}
            htselect.Add("@Trans", "INSERT_ALL_USER_ORDERS");
            dtselect = dataaccess.ExecuteSP("Sp_Order_Allocate", htselect);

            DataSet   ds       = new DataSet();
            DataTable dtparent = new DataTable();
            DataTable dtchild  = new DataTable();
            dtparent           = gen.FillParentTable();
            dtparent.TableName = "A";

            dtchild           = gen.FillChildTable();
            dtchild.TableName = "B";

            ds.Tables.Add(dtparent);
            ds.Tables.Add(dtchild);

            ds.Relations.Add("Main_id", dtparent.Columns["Main_id"], dtchild.
                             Columns["Main_id"]);

            if (ds.Tables[0].Rows.Count > 0)
            {
                TreeView1.Nodes.Clear();

                foreach (DataRow masterRow in ds.Tables[0].Rows)
                {
                    TreeNode masterNode = new TreeNode((string)masterRow["Main_Name"],
                                                       Convert.ToString(masterRow["Main_Id"]));
                    TreeView1.Nodes.Add(masterNode);
                    TreeView1.CollapseAll();
                    foreach (DataRow childRow in masterRow.GetChildRows("Main_id"))
                    {
                        TreeNode childNode = new TreeNode((string)childRow["User_Name"],
                                                          Convert.ToString(childRow["Main_id"]));
                        masterNode.ChildNodes.Add(childNode);
                        childNode.Value = Convert.ToString(childRow["User_id"]);
                    }
                }
            }
            TreeView1.ExpandAll();
        }
        catch (Exception ex)
        {
            throw new Exception("Unable to populate treeview" + ex.Message);
        }
    }