Eval a field in a Xpath Filtered Data Source

G

gouraud

Hello,

I'm working on Visual Web Developper (ASPX with C# code Behind)

I would like to fill a DataList with items using this format (with as
item as elements) :
"file[title] - element[value]", example : "MyTitle - Theme A"

The problem is that labels, which are binded to theses fields, return
me an error :
"DataBinding: 'System.Web.UI.WebControls.XmlDataSourceNodeDescriptor'
does not contain a property with the name 'title'."
"DataBinding: 'System.Web.UI.WebControls.XmlDataSourceNodeDescriptor'
does not contain a property with the name 'value'."

Do you know how can I define the wanted fields in Eval Expression ?


To do this, I have :
- Created a DataList
- Associated it with an XML DataSource.
- Filtered this XML with an XPath Expression : "//file[@id="3"]//."
(This expression return the file node with all his children.)
- Created a label object, with a DataBinding to title field :
"Eval("title")"
- Created a label object, with a DataBinding to child value field :
"Eval("value")"


Here is my XML Datasource.

<files>
<file id="3" name="myName" nbSlides="10" title="MyTitle">
<element id="1" type="theme" value="Theme A" slide_start="2"
slide_end="4" />
<element id="2" type="theme" value="Theme B" slide_start="5"
slide_end="5" />
<element id="3" type="theme" value="Theme C" slide_start="6"
slide_end="9" />
</file>
</files>

Thanks a lot for any help !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top