Getting values from umbraco.library.GetCurrentMember() in .net usercontrol
Guys,
I'm trying to access some data in my .net usercontrol. Specifically I want to know the node id of the currently logged on member. Any idea how I should do this?
Here's some code I have right now:
dynamic xmlv = new DynamicXml(umbraco.library.GetCurrentMember()); foreach (var property in xmlv) { foreach (var item in property) { Response.Write(item.InnerText); Response.Write("<br/>"); } Response.Write(property.naam); Response.Write("<br/>???"); }
This returns absolutely nothing.
P.S: I'm more of an XSLT guy so please be really specific.
After hours of going crazy I found a way to do it.
Let's sat you have a member xml that looks like this:
gsidoel
kernkampweg 4-6 Paramaribo
And you wanted to read the value of nickname. You can do that like this:
//get the currently logged in member XPathNodeIterator member = umbraco.library.GetCurrentMember(); //set up a reader to read out the member's xml XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(member.Current.OuterXml));
//move to the selected element reader.ReadToFollowing("nickname"); //write the elements value Response.Write("Content of the element: " + reader.ReadElementContentAsString());
Getting values from umbraco.library.GetCurrentMember() in .net usercontrol
Guys,
I'm trying to access some data in my .net usercontrol. Specifically I want to know the node id of the currently logged on member. Any idea how I should do this?
Here's some code I have right now:
This returns absolutely nothing.
P.S: I'm more of an XSLT guy so please be really specific.
Nevermind,
After hours of going crazy I found a way to do it.
Let's sat you have a member xml that looks like this:
kernkampweg 4-6Paramaribo
And you wanted to read the value of nickname. You can do that like this:
is working on a reply...