p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XML
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

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: 30
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.
--------------------------------------------------------------------------

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Repeater Using Stored Procedure kwilliams ASP.NET 2.0 Professional 1 July 21st, 2008 07: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 05: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 10:52 AM



All times are GMT -4. The time now is 04:43 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc