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