I create a RadRotator in run time and i bind on an xml file .


I don't know How to get the title from the rotator to set the text of my label .


lbl_date.Text = (lbl_date.NamingContainer as RadRotatorItem).DataItem 

My xml part :

<news pnumber="1" id="1"><event_id>578</event_id><event_type_id>1</event_type_id><language_id>2</language_id><title>meeting</title></news>
有帮助吗?

解决方案 2

Finally i get it :


lbl_date.Text = XPathBinder.Eval((((lbl_date.NamingContainer as RadRotatorItem)).DataItem), "./title", "");

其他提示

Try using an XDocument to parse the XML:

var xdoc = XDocument.Parse(xml);

lbl_date.Text = xdoc.Root.Element("title").Value;

Note that the element name "title" used in the call .Element("title") is case sensitive.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top