EDN Admin
Well-known member
Im using a GridView to display an XML file that lists upcoming events. The XML file is laid out like this
<pre class=alt2 style="border-right:1px inset;padding-right:3px;border-top:1px inset;padding-left:3px;padding-bottom:3px;margin:0px;overflow:auto;border-left:1px inset;width:740px;padding-top:3px;border-bottom:1px inset;height:322px <font size=3><?xml version="1.0" encoding="utf-8" ?>
<events>
<item>
<date>20080701</date>
<description>Event B</description>
</item>
<item>
<date>20080622</date>
<description>Event A</description>
</item>
<item>
<date>20080901</date>
<description>Event D</description>
</item>
<item>
<date>20080801</date>
<description>Event C</description>
</item>
</events></font>[/code]
As you can see, Ive put the date in yyyyMMdd format. I want to sort these items by date in ascending order in the GridView. Im looking for the best way to do that. I havent been able to figure it out so far using XPathNavigator or XSLT. I could certainly use a hand.
Thanks in advance for any helpful feedback. Ive been trying to figure this out for a few days, but I cant seem to find sample code online that applies closely enough to what Im trying to do.
View the full article
<pre class=alt2 style="border-right:1px inset;padding-right:3px;border-top:1px inset;padding-left:3px;padding-bottom:3px;margin:0px;overflow:auto;border-left:1px inset;width:740px;padding-top:3px;border-bottom:1px inset;height:322px <font size=3><?xml version="1.0" encoding="utf-8" ?>
<events>
<item>
<date>20080701</date>
<description>Event B</description>
</item>
<item>
<date>20080622</date>
<description>Event A</description>
</item>
<item>
<date>20080901</date>
<description>Event D</description>
</item>
<item>
<date>20080801</date>
<description>Event C</description>
</item>
</events></font>[/code]
As you can see, Ive put the date in yyyyMMdd format. I want to sort these items by date in ascending order in the GridView. Im looking for the best way to do that. I havent been able to figure it out so far using XPathNavigator or XSLT. I could certainly use a hand.
Thanks in advance for any helpful feedback. Ive been trying to figure this out for a few days, but I cant seem to find sample code online that applies closely enough to what Im trying to do.
View the full article