After i get this work. i realize that, since i want to use this object as root for a menu, the iteration on object must be done outside a view, since, if i get from the view, i'll lost the object passed to it by parameter.
I had two diferente ideias but got stuck on both. First was to use a partial view (i didn't get to have any reference to my xml object there) - why?!
My second try was to pass the object to a viewdata and called it on site.master directly. Which is the best aproach?
I follow the 2nd one and got stuck, since i can't convert from the viewdata object to my object it self, or i can but having this error:
" Message=Unable to cast object of type 'NerdDinner.Models.MenuContainer' to type 'System.Collections.Generic.IEnumerable`1[NerdDinner.Models.MenuContainer]'.
"
This happens when on my site.master i do this:
Code:
<% foreach (NerdDinner.Models.MenuContainer varc in (IEnumerable<NerdDinner.Models.MenuContainer>)ViewData["XmlDoc"])
{%>
<%}
%>
I had posted a similar doubt on asp.net foruns, btw.