Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 19th, 2007, 03:53 AM
Authorized User
 
Join Date: Nov 2007
Location: Allahabad, UP, India.
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.
--------------------------------------------------------------------------

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.