data is not getting ordered by date
- by raging_boner
Can't get list sorted by date. How to show data ordered by date?
XDocument doc = XDocument.Load(Server.MapPath("file.xml"));
IEnumerable<XElement> items = from item in doc.Descendants("item")
orderby Convert.ToDateTime(item.Attribute("lastChanges").Value) descending
where item.Attribute("x").Value == 1
select item;
Repeater1.DataSource = items;
Repeater1.DataBind();
Xml file looks like this:
<root>
<items>
<item id="1" lastChanges="15-05-2010" x="0" />
<item id="2" lastChanges="16-05-2010" x="1" />
<item id="3" lastChanges="17-05-2010" x="1" />
</items>
</root>