Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 19th, 2007, 03:53 AM
Authorized User
 
Join Date: Nov 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with binding XMl data into nested repeater

Hello every one !
How can I display data into repeater control..
for eg. I have to display data in the following format from XML
rediffHomePage(First Repeater)
--HotJobs(Second Repeater)
--Label(Second Repeater)
rediffHomePage1(First Repeater)
--Images (Second Repeater)
--Air Tickets(Second Repeater)

I have to display <Label> of <ScreenToSupport> and below this label I have to display <Label> of

FieldsToSupport/FieldToSupport for each <ScreenToSupport>.
How can I bind repeater..

Following is structure my XML file
--------------------------------------------------------------------------
<ScreensToSupport>
    <ScreenToSupport>
      <ScreenUniqueId>199d1dfd-63ca-4271-b234-77da0f579e0e</ScreenUniqueId>
      <SupportItems>
        <ScreenSupportItem>
          ...
    <RefId>1</RefId>
        </ScreenSupportItem>
      </SupportItems>
      <FieldsToSupport>
        <FieldToSupport>
          ...
          <Label>HotJobs</Label>
          ...
          <FieldSupportItems />
        </FieldToSupport>
        <FieldToSupport>
          ...
          <Label>Game</Label>
          ...
          <FieldSupportItems />
        </FieldToSupport>
      </FieldsToSupport>
      <Label>rediffHomePage</Label>

</ScreenToSupport>
    <ScreenToSupport>
      <ScreenUniqueId>e62abc49-efc7-4a5d-908f-33f2f4df070b</ScreenUniqueId>
      <SupportItems>
        <ScreenSupportItem>
          ...
    <RefId>2</RefId>
        </ScreenSupportItem>
      </SupportItems>
      <FieldsToSupport>
        <FieldToSupport>
          ..
          <Label>Images</Label>
          ..
          <FieldSupportItems />
        </FieldToSupport>
        <FieldToSupport>
          ...
          <Label>Air Tickets</Label>
          ...
          <FieldSupportItems />
        </FieldToSupport>
      </FieldsToSupport>
      <Label>rediffHomePage1</Label>
    </ScreenToSupport>
  </ScreensToSupport>
--------------------------------------------------------------------------
and the code written in c# to extract data from XML given below
--------------------------------------------------------------------------
XmlDocument objXmlDocument = new XmlDocument();
        objXmlDocument.Load(strAlbumPath + "\\" + strAlbumName + ".linkinfo.xml");
        int count = 0;
        int intChildCount = 0;
        XmlNodeList objList =

objXmlDocument.SelectNodes("/LinkInformation/ScreensToSupport/ScreenToSupport");
        string lsString = "";
        String strParentLabel = "";
        string strChildLabel = "";
        foreach (XmlNode objChild in objList)
        {
            foreach (XmlElement elementParentLabel in objChild)
            {
                if (elementParentLabel.Name == "Label")
                {
                    strParentLabel = strParentLabel + elementParentLabel.InnerText + ";";
                    Response.Write("Parent Label :" + strParentLabel + " ");
                    break;
//This Line gives all Label of <ScreenToSupport> here I have to bind repeater control to display

Label rediffHomePage and rediffHomePage1
                }
            }
            foreach (XmlNode objChild2 in objChild.ChildNodes)
            {
                if (objChild2.Name == "FieldsToSupport")
                {
                    intChildCount = objChild2.ChildNodes.Count;
                    XmlNodeList childF2S = objChild2.ChildNodes;
                    foreach (XmlNode nodeF2SLable in childF2S)
                    {
                        foreach (XmlElement elementLabel in nodeF2SLable)
                        {
                            if (elementLabel.Name == "Label")
                            {
                                strChildLabel = strChildLabel + elementLabel.InnerText + ";";
                                count++;
                                if (count == intChildCount)
                                {
                                    Response.Write("ChildLabel : " + strChildLabel + " ");
                                    break;
//This Line gives all Label of FieldsToSupport/FieldToSupport for respective <ScreenToSupport> Label

here I have to bind repeater control to display Label HotJobs, Game (FieldsToSupport/FieldToSupport)

for rediffHomePage (<ScreenToSupport>) and Images, Air Tickets for rediffHomePage1.
                                }
                            }
                        }
                    }
                }
            }
            count = 0;
            strChildLabel = "";
        }
--------------------------------------------------------------------------
How can I bind both repeater to dispaly data in the required format.
--------------------------------------------------------------------------






Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Repeater Using Stored Procedure kwilliams ASP.NET 2.0 Professional 1 July 21st, 2008 06:49 PM
How to dispaly attributes of xml nested repeater.. vishnu108mishra XML 0 November 15th, 2007 07:38 AM
nested repeater ramonjor ASP.NET 2.0 Basics 0 July 31st, 2007 04:18 AM
FindControl in nested repeater chrisk_47 .NET Framework 2.0 0 February 6th, 2007 10:45 PM
nested repeater david_ste ASP.NET 2.0 Professional 0 August 24th, 2006 09:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.