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

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'