Access each node from List


hi all, trying access each node list. facing problem. structure of items in list mentioned below:

a1
   a1_1
         a1_1_1
         a1_1_2
         a1_1_3
   a1_2
         a1_2_1
         a1_2_1
   a1_3
b2
   b2_1
         b2_1_1
         b2_1_2
c3

i able access each items of "a1" node (including sub-nodes well), not able access items of "b2" , "c3". here code:

        public void recursivenode(list<idatanode> node, string stroperation)          {              foreach (idatanode node in node)              {                  if (node.countchildren > 0)                  {                      if (stroperation == "expand" && node.expanded != true)                      {                          node.expanded = !node.expanded;                            preparenodes(m_pos, node.expanded);                      }                      m_pos += 1;                      recursivenode(node.children, stroperation);                                      }                  else                   {                      m_pos += 1;                      continue;                  }              }          }

please correct me wrong?


windows 8.1 enterprise, processor : i3-3220, ram : 8 gb, system type : 64-bit operating system, microsoft visual studio ultimate 2012

thanks denis quick response.<o:p></o:p>

the problem has been resolved.<o:p></o:p>

the problem not did believe. actually, main list (m_mapper) being modified inside "preparenodes ()" function. and, not aware of that. now, have written different logic , not required recursive functionality. working fine me expected.<o:p></o:p>

        public void expandcollapseallnodes(string stroperation)         {             int countprvsnodechildren = 0;             int numofitems = m_mapper.count;             (int index = 0; index < numofitems; index++)             {                 idatanode mbr = m_mapper[index];                  if (mbr.countchildren > 0)                 {                     mbr.expanded = !mbr.expanded;                      preparenodes(index, mbr.expanded);                     countprvsnodechildren = mbr.countchildren;                 }                 else if (countprvsnodechildren > 0 && stroperation == "expandall")                 {                     index += countprvsnodechildren - 1;                     countprvsnodechildren = 0;                 }                 numofitems = m_mapper.count;             }         }


windows 8.1 enterprise, processor : i3-3220, ram : 8 gb, system type : 64-bit operating system, microsoft visual studio ultimate 2012



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'