c# to read xml file and update the checkboxes with the nodes -


i have xml file this:

<servers> <general name="1">               <service name="ser1"/>         <service name="ser2"/>   </general> <general name="2">               <service name="ser1"/>         <service name="ser2"/>   </general> </servers> 

in winform application, have treeview list checkbox property set true.what trying achieve attempting read xml file , update both parent , child node tree view.

what have tried is:

xdocument doc = xdocument.load(@"d:\\path.xml");         treenode node;                         var gnrl = general in doc.descendants("general")                        select new                        {                            parent = general.attribute("name").value,                            child = general.descendants("service")                        };             //loop through results             foreach (var general in gnrl)             {                  // add root node.             node = dcselectview.nodes.add(string.format(general.parent));                 foreach (var ser in general.child)                 {                         // add node child of added node.                         node = node.nodes.add(string.format(ser.attribute("name").value));                                         }            } 

it reads file , details updated not in proper way. rather shown below:

enter image description here

needed:

i want parent element on top , down-right it,the child elements. if possible, nice if dont have checkboxes parent elements.

any appreciated..

edit:

my code edited. getting shown in new picture below:

enter image description here

i want 2 black lines in same line,not child node of another..

do want hierarchical structure, this?

enter image description here

if so, recommend @ treeview: http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.checkboxes.aspx


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -