how to display the selected node from the treeview in the textbox?
<p>Hi im having treeview with checkbox and 1 submit button it is taking values from database.</p>

<p>now if i check the checkbox and click the submit button it should display the selected node in the textbox.....</p>

<p>here is my treeview code</p>

<pre><code>public void Load_tree()
    {
        DataSet PrSet = PDataset("SELECT * FROM tbl_saleschannelhierarchyconfig");
        TreeView1.Nodes.Clear();
        foreach (DataRow dr in PrSet.Tables[0].Rows)
        {
            if ((int)dr["ParentID"] == 0)
            {
                TreeNode tnParent = new TreeNode();
                tnParent.Text = dr["Parent"].ToString();
                string value = dr["ParentID"].ToString();
                //tnParent.Text = dr["SalesChannelName"].ToString(); - if u use this   instead of the previous two lines, then "kmart" will be the parent. else "root" will be the parent.
                //string value = dr["SalesChannelConfigID"].ToString();
                tnParent.Expand();
                TreeView1.Nodes.Add(tnParent);
                FillChild(tnParent, value);
            }
        }
    }       
    public int FillChild(TreeNode parent, string SalesChannelConfigID)
    { 
        DataSet ds = PDataset("SELECT * FROM tbl_saleschannelhierarchyconfig WHERE   ParentID =" + SalesChannelConfigID); 
        if (ds.Tables[0].Rows.Count &gt; 0)
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TreeNode child = new TreeNode(); 
                child.Text = dr["SalesChannelName"].ToString().Trim(); 
                string temp = dr["SalesChannelConfigID"].ToString(); 
                child.Collapse();
                parent.ChildNodes.Add(child);
                FillChild(child, temp); 
            }
            return 0;
        } 
        else
        { 
            return 0; 
        } 
</code></pre>

<p>and button click code</p>

<pre><code>   protected void Button1_Click(object sender, EventArgs e)
    {

        txtRetailCustomerGroup.Text = TreeView1.SelectedNode.Parent.ToString();
    }
</code></pre>

<p>it is showing this exception 
"Object reference not set to an instance of an object."</p>

<p>can any1 help me??</p>
