Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Binding treeview[urgent plz]

Binding treeview[urgent plz]

Scheduled Pinned Locked Moved C#
wpfwcfhelp
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nisha 2n
    wrote on last edited by
    #1

    hai....help me plz....urgent i create data table for treeview lik dis with hospital name as treenodes|Dr names as subnodes .. Apolo|Dr.jhon Image|Dr.Krish Care|Dr.Ram Apolo|Dr.sri Image|Dr.prabhu Care|Dr.san i want treeview display lik dis.... -.Apolo . . . . . .Dr.jhon . .Dr.sri . -Image . . . . . .Dr.prabhu . .Dr.Krish . -Care . . .Dr.Ram .Dr.san but in treeview it displaying lik dis..it opening in another treenodes with single name.. -.Apolo . . . . . .Dr.jhon . . -Image . . . . . .Dr.prabhu . . -Care . . .Dr.Ram -.Apolo . . . . . . .Dr.sri . -Image . . . . . . .Dr.Krish . -Care . . .Dr.san thanqu....:)

    A L N 3 Replies Last reply
    0
    • N nisha 2n

      hai....help me plz....urgent i create data table for treeview lik dis with hospital name as treenodes|Dr names as subnodes .. Apolo|Dr.jhon Image|Dr.Krish Care|Dr.Ram Apolo|Dr.sri Image|Dr.prabhu Care|Dr.san i want treeview display lik dis.... -.Apolo . . . . . .Dr.jhon . .Dr.sri . -Image . . . . . .Dr.prabhu . .Dr.Krish . -Care . . .Dr.Ram .Dr.san but in treeview it displaying lik dis..it opening in another treenodes with single name.. -.Apolo . . . . . .Dr.jhon . . -Image . . . . . .Dr.prabhu . . -Care . . .Dr.Ram -.Apolo . . . . . . .Dr.sri . -Image . . . . . . .Dr.Krish . -Care . . .Dr.san thanqu....:)

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      Its because you have to add your Doctor nodes as children of your hospital ones.

      Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

      1 Reply Last reply
      0
      • N nisha 2n

        hai....help me plz....urgent i create data table for treeview lik dis with hospital name as treenodes|Dr names as subnodes .. Apolo|Dr.jhon Image|Dr.Krish Care|Dr.Ram Apolo|Dr.sri Image|Dr.prabhu Care|Dr.san i want treeview display lik dis.... -.Apolo . . . . . .Dr.jhon . .Dr.sri . -Image . . . . . .Dr.prabhu . .Dr.Krish . -Care . . .Dr.Ram .Dr.san but in treeview it displaying lik dis..it opening in another treenodes with single name.. -.Apolo . . . . . .Dr.jhon . . -Image . . . . . .Dr.prabhu . . -Care . . .Dr.Ram -.Apolo . . . . . . .Dr.sri . -Image . . . . . . .Dr.Krish . -Care . . .Dr.san thanqu....:)

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        It is because you are adding everything to the TreeView's Nodes collection. You have to take care of the hierarchy, TreeView cannot automatically do it for you.

        TreeNode hostpitalNode;
        hostpitalNode = treeView1.Nodes.Add("Apolo");
        hostpitalNode.Nodes.Add("Dr. Krish");

        And while posting, follow the guidelines, it is 'urgent' for you, not for others.

        N 2 Replies Last reply
        0
        • N nisha 2n

          hai....help me plz....urgent i create data table for treeview lik dis with hospital name as treenodes|Dr names as subnodes .. Apolo|Dr.jhon Image|Dr.Krish Care|Dr.Ram Apolo|Dr.sri Image|Dr.prabhu Care|Dr.san i want treeview display lik dis.... -.Apolo . . . . . .Dr.jhon . .Dr.sri . -Image . . . . . .Dr.prabhu . .Dr.Krish . -Care . . .Dr.Ram .Dr.san but in treeview it displaying lik dis..it opening in another treenodes with single name.. -.Apolo . . . . . .Dr.jhon . . -Image . . . . . .Dr.prabhu . . -Care . . .Dr.Ram -.Apolo . . . . . . .Dr.sri . -Image . . . . . . .Dr.Krish . -Care . . .Dr.san thanqu....:)

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Marking the post as urgent and requesting urgent help is very rude around here. :mad:


          I know the language. I've read a book. - _Madmatt

          N 1 Reply Last reply
          0
          • L Lost User

            It is because you are adding everything to the TreeView's Nodes collection. You have to take care of the hierarchy, TreeView cannot automatically do it for you.

            TreeNode hostpitalNode;
            hostpitalNode = treeView1.Nodes.Add("Apolo");
            hostpitalNode.Nodes.Add("Dr. Krish");

            And while posting, follow the guidelines, it is 'urgent' for you, not for others.

            N Offline
            N Offline
            nisha 2n
            wrote on last edited by
            #5

            hai...sory sory...im new for thees messages ......i dono how 2 write...forgive me yar...:) any ways thanqu for ur reply....:)

            1 Reply Last reply
            0
            • N Not Active

              Marking the post as urgent and requesting urgent help is very rude around here. :mad:


              I know the language. I've read a book. - _Madmatt

              N Offline
              N Offline
              nisha 2n
              wrote on last edited by
              #6

              hai...sory sory...im new for thees messages ......i dono how 2 write...forgive me yar...:)

              N 1 Reply Last reply
              0
              • N nisha 2n

                hai...sory sory...im new for thees messages ......i dono how 2 write...forgive me yar...:)

                N Offline
                N Offline
                Not Active
                wrote on last edited by
                #7

                If you are new here then you should have read this[^] correct?


                I know the language. I've read a book. - _Madmatt

                1 Reply Last reply
                0
                • L Lost User

                  It is because you are adding everything to the TreeView's Nodes collection. You have to take care of the hierarchy, TreeView cannot automatically do it for you.

                  TreeNode hostpitalNode;
                  hostpitalNode = treeView1.Nodes.Add("Apolo");
                  hostpitalNode.Nodes.Add("Dr. Krish");

                  And while posting, follow the guidelines, it is 'urgent' for you, not for others.

                  N Offline
                  N Offline
                  nisha 2n
                  wrote on last edited by
                  #8

                  hai...Shameel.....yah i tried ..but again it displaying in hierarchy manner...i dont want Dr's name displaying in another same hospital name.... (actuly i given in Data table ,,in same hospital name with 2 Dr's names....but...its displaying in 2 different treenodes...i want 2 show in single hospital name with 2 Dr's names) Apolo|Dr.jhon Image|Dr.Krish Care |Dr.Ram Apolo|Dr.sri Image|Dr.prabhu Care |Dr.san public void TreeviewBind() { query= "Select * from Clinic_tbl"; da = new SqlDataAdapter(query, con); DataSet ds = new DataSet(); da.Fill(ds, "Clinic"); foreach (DataRow row in ds.Tables[0].Rows) { rootNode = treeView1.Nodes.Add(row[0].ToString()); rootNode.Nodes.Add(row[1].ToString()); } } i hope u understod my lang..im new for Dotnet...this is my 1st project.........thanqu:)

                  L 1 Reply Last reply
                  0
                  • N nisha 2n

                    hai...Shameel.....yah i tried ..but again it displaying in hierarchy manner...i dont want Dr's name displaying in another same hospital name.... (actuly i given in Data table ,,in same hospital name with 2 Dr's names....but...its displaying in 2 different treenodes...i want 2 show in single hospital name with 2 Dr's names) Apolo|Dr.jhon Image|Dr.Krish Care |Dr.Ram Apolo|Dr.sri Image|Dr.prabhu Care |Dr.san public void TreeviewBind() { query= "Select * from Clinic_tbl"; da = new SqlDataAdapter(query, con); DataSet ds = new DataSet(); da.Fill(ds, "Clinic"); foreach (DataRow row in ds.Tables[0].Rows) { rootNode = treeView1.Nodes.Add(row[0].ToString()); rootNode.Nodes.Add(row[1].ToString()); } } i hope u understod my lang..im new for Dotnet...this is my 1st project.........thanqu:)

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    Your code does what you have asked it to do. It is your headache to find out if the hospital is already added to the TreeView and add your doctor there. Hint: Use treeView1.Nodes.Find() to find out if the hospital is already added. Your first problem is that your table is not normalized.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups