tags:

views:

61

answers:

1

I have a Xml Document (LessonData.xml) with lesson data in it, with the following format:

<Lessons>
 <Lesson ID= *GUID Number*>
  <FullName>John Smith</FullName>
  <Date>04/01/2010</Date>
 </Lesson>

In c#, I have a windows app form, with a combobox. In this combobox, I have put in selections of the week dates, ie: "04/01/2010 - 10/01/2010", "11/01/2010 - 17/01/2010", etc. And then a 'Load' button.

What I want to do is select the week range from the combobox, click 'Load', then have all the lessons in that date range display (in a textbox or something).

How can I set the to equal being part of the week selection? Thanks.

+1  A: 

Query:

var lessons = from lDate 
              in xmlDocument.SelectNodes("/Lessons/Lesson/Date").Cast<XmlNode>()
              where DateTime.Parse(lDate.InnerText) > selectedDay
                 && DateTime.Parse(lDate.InnerText) < selectedDay.AddDays(7)
              select lDate.ParentNode;

Ouput:

foreach (var lesson in lessons)
   lblOutput.Text += lesson.InnerXml;
andreas