Asp.net and trees?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
4 views
Hello. Learn a little ASP.NET and can not seem to understand how to derive a tree structure from xml with unknown depth. (Perhaps using a TreeView)

xslt then probably will not work because I have each item has the checkbox that you want to hang the event .net

That is, I have xml like this:




And you need to withdraw:

test1test11.... test2
by | 4 views

2 Answers

0 like 0 dislike
So you can just continue to withdraw. Something like this:
\r
\r
var str = @"\r\r\r\r\r\r\r\r\r"; var rootNode = XElement.Parse(str); OutNode(rootNode); void OutNode(XElement rootNode) { Console.WriteLine ("ul"); foreach(var node in rootNode.Elements().Where(x => x.Name=="item") ) { Console.WriteLine ("li"); Console.WriteLine (node.Attribute("name").Value); if(node.HasElements) OutNode(node); Console.WriteLine ("/li"); } Console.WriteLine ("/ul"); } 

\r
Well and place directly in the template method helper or as convenient.
by
0 like 0 dislike
And, you can write a small xslt ' and "twirl" in this conversion as I want, without changing the program code
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 10, 2019 by roman_CH
110,608 questions
257,186 answers
0 comments
27,923 users