Get treeview record from TreeNode


here code sample. getting records database , generate treeview dynamically.

code:

=======

omanuinterfaces = manuinterfaces.gets();


            treenode node;

            foreach (manuinterface oitem in omanuinterfaces)
            {
                if (oitem.is_perent == true)
                {
                    node = tree.nodes.add(oitem.manu_title);

                    ochildmanu = manuinterfaces.getschildmanu(oitem.objectid);
                    if (ochildmanu.count > 0)
                    {
                        foreach (manuinterface childoitem in ochildmanu)
                        {
                            node.nodes.add(childoitem.manu_title);

                            if (childoitem.sub_parent == true)
                            {
                                osubchildmanu = manuinterfaces.getssubchildmanu(childoitem.objectid);
                                if (osubchildmanu.count > 0)
                                {
                                    foreach (manuinterface subchildoitem in osubchildmanu)
                                    {
                                        node.nodes[0].nodes.add(subchildoitem.manu_title);
                                    }
                                }
                                osubchildmanu.clear();
                            }
                        }
                    }
                    ochildmanu.clear();
                }
            }

==============

how can node key selected node?

                                                                       

hi, don't know program you're developing, winform, wpf or others?

but have save node key these nodes when fill treeview.

you can create subclass of treenode, , subclass includes property saving node key.





Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

SQL Server 2008 - High Memory Usage

Problem In Configuring Biztalk 2009 In Creating A ReceivePort.When I Try To Create A Receive POrt I Got This Error

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts