26 February 2007

Solution: How to get the InnerText value of a node when using XmlDataSource

Lets say you have this xml:

<Blog>

<BlogPost Date="2/21/2006" Title="Blog Title">

Blog Content

</BlogPost> 

</Blog> 

 

And you are using an XmlDataSource to run it through a repeater.

 

You can easily get the attributes like so: <%#Eval("Date")%>

 

To get the innerText (the blog content) one option is to use the XPath operator like so: <%# XPath(".") %>
 

Filed under: ,
 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Bjorn van der Neut said:

Nice just what I was looking for!

17 October 08 at 5:26 AM

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Page view tracker