cancel
Showing results for 
Search instead for 
Did you mean: 

Adding node to SAP PDK tree control dynamically

Former Member
0 Kudos

Hello all,

I am using Tree control of the SAP PDK.NET and i want to add nodes as well as sub-nodes to that tree.

The data is coming from the web service and i want to assign that data to the tree nodes.

Can anybody helps me in?

Thanks in advance,

Prashant

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can do it easily, use the following code as an exmple:

(just drop Button & Tree control first)

 protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Tree1.RootNode = (TreeNode)Session["tree"];
            }
        }

        protected void Button1_Action(object sender, AbstractButton.ActionEventArgs e)
        {
            TreeNode node = new TreeNode(Tree1);
            node.Text = DateTime.Now.ToLongTimeString();
            Tree1.RootNode.Nodes.AddAt(Tree1.RootNode.Nodes.Count,node);
            Session["tree"] = Tree1.RootNode;
            
        }

Regards,

Yehuda

Answers (0)