Manoj Bisht

Manoj Bisht

  • NA
  • 145
  • 0

XML with GridView

Feb 4 2009 4:48 AM
Hello Freinds,

I've a GridView in which i'm fetching the data from the XMLFile.
My XML file is shown below. In this XML file i've a Active node and i want to display only the data where the Active is 1 that's mean to fetch only first record but it's bringing all records.

<TotalBhakti>
  <Videos>
    <ID>1</ID>
    <Video>No Video(s)</Video>
    <VideoTitle>No Video Title</VideoTitle>
    <Description>No Description</Description>
    <Guru>No Guru</Guru>
    <Lord>No Lord</Lord>
    <Category>No Category</Category>
    <Genre>No Genre</Genre>
    <Tag>No Tag</Tag>
    <Active>1</Active>
  </Videos>

  <Videos>
    <ID>2</ID>
    <Video>No Video(s)</Video>
    <VideoTitle>No Video Title</VideoTitle>
    <Description>No Description</Description>
    <Guru>No Guru</Guru>
    <Lord>No Lord</Lord>
    <Category>No Category</Category>
    <Genre>No Genre</Genre>
    <Tag>No Tag</Tag>
    <Active>0</Active>
  </Videos>
</TotalBhakti>



here is the code to display in the GridView
 XmlDataSource data = new XmlDataSource();
            data.DataFile = Server.MapPath("~/XMLFiles/XMLFile1.xml");            
            GridView1.DataSource = data;
            GridView1.DataBind();

Answers (1)