Problem with displaying attributes of xml into nested repeater..How to dispaly attributes of xml nested repeater..(if XML not followed hierarchical structure)

Hello every one I am facing a problem to display attribute of parent node and corresponding child nodes.Suppose I have to display Label attributes of all <ScreenToSupport>. There can be multiple <ScreenToSupport> inside parent node <ScreensToSupport>. In this case I have to display Label 'rediffHomePage' and 'rediffHomePage1' of both <ScreenToSupport> node. There is no issue to diplay these two Label. I done this by taking a repeater control.
But problem arrises when I have to display corresponding Label of 'FieldsToSupport/FieldToSupport' of <ScreenToSupport>..For example on click an Item like rediffHomePage from a repeater It should display like 'HotJobs' and 'Game'. How can I display Label of corresponding FieldsToSupport/FieldToSupport on click on corresponding Label of <ScreenToSupport>.. Should I take Repeater inside Repeater  or I Repeater inside DataList.
following is the structure of 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 following is my .cs file
--------------------------------------------------------------------
<%@ Page Language="C#" MasterPageFile="~/BaydonHeader.master" AutoEventWireup="true"

CodeFile="list_labels.aspx.cs" Inherits="list_labels" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="Baydon"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<asp:Content ID="Content2" ContentPlaceHolderID="cphDetail" runat="Server">
<script runat="server">
             
 public void Page_Load(Object sender, EventArgs e){
        string AlbumPath = Request.QueryString["AlbumPath"];
        string AlbumName = Request.QueryString["AlbumName"];
        string path=AlbumPath + "/" + AlbumName + ".linkinfo.xml";
        XmlDataSource1.DataFile = path;
       // XmlDataSource2.DataFile = path;
        
        XmlDataSource2.Data = "<FieldsToSupport><FieldToSupport><Label>Just To Test

1</Label></FieldToSupport><FieldToSupport><Label>Just To Test

2</Label></FieldToSupport></FieldsToSupport>";
        
        if (!IsPostBack) {
            string xmlFilePath = @path;
            UpdateXml();
            //XmlDocument doc = new XmlDocument();
            //doc.Load(xmlFilePath);
            System.Data.DataSet objDataSet = new DataSet();
            objDataSet.ReadXml(path);
        }
    }
    
    public void UpdateXml()
    {
        try
        {

                string AlbumPath = Request.QueryString["AlbumPath"];
                string AlbumName = Request.QueryString["AlbumName"];
                string path = AlbumPath + "\\" + AlbumName + ".linkinfo.xml";
                XmlDocument doc = new XmlDocument();
                doc.Load(path);
                System.Data.DataSet objDataSet = new DataSet();
                objDataSet.ReadXml(path);

                int intRefId = 1; //Request.QueryString["RefId"].ToString();
                
            /*ls*/
                string strXPathLS =

"/LinkInformation/ScreensToSupport/ScreenToSupport/SupportItems/ScreenSupportItem[RefId='" +

intRefId + "']";
                XmlNode newParentLS = doc.SelectSingleNode(strXPathLS).ParentNode.NextSibling;
                
                /*
                Repeater repeaterLS = new Repeater();
                repeaterLS=(Repeater)Repeater1.FindControl("Repeater2");
                Repeater3.DataSource = newParentLS;
                Repeater3.DataBind();
                */
            
                /*
                foreach (System.Xml.XmlNode node1LS in newParentLS)
                {
                    Response.Write(node1LS["Label"].InnerText + "<br>");
                }
                */
            /*ls*/            
        }
        catch (Exception err)
        {
            Response.Write(err);
            //lblError.Text = "ERROR:" + err.Message.ToString();
            //txtUrlTitle.Focus();
        }

    }
 
</script>

<script type="text/javascript">

function showCD(str)
{
// var strXML=document.getElementById("scid").value;
//   alert(strXML);
var imgId=str;

function getURLParam(strParamName){
 
var strPath = "";
var strName = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    strPath = aQueryString[0];
    strName = aQueryString[1];
    var url="list_labels.aspx"+strPath+"&"+strName+"&ImgId="+imgId;
    window.location=url;
  }
}
getURLParam("AlbumPath");

}
</script>
<div align="center">  
 <fieldset class="fieldset1" style="border-bottom-color:#6699ff;

border-left-color:#6699ff;border-right-color:#6699ff; border-top-color:#6699ff;

border-style:groove;">
   
         <table style="width: 100%; height: 100%">
           
            <tr>
                <td align="left" style="width: 19%; height: 100%" valign="top">
                
                    <table style="border-right: #6699ff thin solid; border-top: #6699ff thin solid;

padding-left: 4px;
                        border-left: #6699ff thin solid; width: 87%; border-bottom: #6699ff thin

solid;
                        height: 90%">
                        <tr>
                            <td align="left" style="width: 216px; height: 100px" valign="top">
                                <table style="height: 40%">
                                    <tr>
                                        <td style="height: 18px; background-color: #0099cc;"

valign="top">
                                       
                                            <asp:Label ID="Label4" runat="server" ForeColor="Black"

Text="Labels" BackColor="Transparent" Font-Bold="True" Font-Size="Medium" Width="216px"></asp:Label>
                                            </td>
                                    </tr>
                                    
                                     <tr>
                                        <td style="height: 175px" valign="top">
                                            <asp:XmlDataSource runat="server" id="XmlDataSource1"

XPath="LinkInformation/ScreensToSupport" />
                                            <asp:XmlDataSource runat="server" id="XmlDataSource2"

XPath="FieldsToSupport" />
                                            
                                            <asp:Repeater ID="Repeater1" runat="server"

DataSourceID="XmlDataSource1">
                                                <ItemTemplate>
                                                    <asp:Repeater ID="Repeater2"

DataSource='<%#XPathSelect("ScreenToSupport")%>' runat="server">                                     

             
                                                        <ItemTemplate>
                                                        <%--<a href="http://forums.asp.net/AddPost.aspx?ForumID=43#"

onclick="showCustomer(<%#XPath(SupportItems/ScreenSupportItem/RefId)%>)"><b><%#XPath("Label")%></b><

/a>--%>
                                                            <input type="button"

onclick="showCD(<%#XPath("SupportItems/ScreenSupportItem/RefId")%>)" value="<%#XPath("Label")%>"

style="border-right: #66ffff thin ridge; border-top: #66ffff thin ridge; font-weight: bold;

font-size: 12px; vertical-align: middle; text-transform: capitalize; border-left: #66ffff thin

ridge; cursor: hand; color: Black; border-bottom: #66ffff thin ridge; font-family: Verdana;

background-color: #E2EBED; text-align: left;width:100%" />
                             <asp:Repeater ID="Repeater3" runat="server"

DataSourceID="XmlDataSource2">
                                  <ItemTemplate>
<asp:Repeater ID="Repeater9" DataSource='<%#XPathSelect("FieldToSupport")%>' runat="server">         

                                         
<ItemTemplate>
                                                 <%#XPath("Label")%> <br />
</ItemTemplate>
</asp:Repeater>
                                   </ItemTemplate>
                             </asp:Repeater>
                                                        </ItemTemplate>
                                                    </asp:Repeater>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                            </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    
                    <table style="border-right: #6699ff thin solid; padding-left: 4px; border-left:

#6699ff thin solid; width: 100%; border-bottom: #6699ff thin solid; height: 90%">
                        <tr>
                            <td style="width: 218px" valign="top">
                                <table style="height: 30%">
                                    <tr>
                                        <td valign="top" style="width: 264px">
                                            <asp:Label ID="Label7" runat="server" ForeColor="Black"

Text="Actions"></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <td valign="top" style="width: 264px; height: 18px">
                                            &nbsp; &nbsp;&nbsp;
                                            </td>
                                    </tr>
                                    <tr>
                                        <td align="left" valign="middle" style="width: 264px">
                                            <asp:ImageButton ID="ImageButton2" runat="server"

ImageUrl="~/images/new.png"  

OnClientClick="document.getElementById('helptypediv').style.visibility='visible';return false;"

/>&nbsp;<asp:ImageButton ID="ImageButton7" runat="server" ImageUrl="~/images/Edit.png"

/>&nbsp;<asp:ImageButton ID="ImageButton8" runat="server" ImageUrl="~/images/Delete.png" /></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 75%" valign="top">
                    <table border="0" cellpadding="0" cellspacing="0" style="border-right: #6699ff

thin solid; border-top: #6699ff thin solid; padding-left: 4px; border-left: #6699ff thin solid;

width: 50%; border-bottom: #6699ff thin solid; height: 50%">
                        <tr>
                            <td colspan="2" style="height: 23px">
                                <asp:ImageButton ID="ImageButton1" runat="server"

ImageUrl="~/images/Page-View-hover.png" />
                                <asp:ImageButton ID="ImageButton6" runat="server"

ImageUrl="~/images/Browser-View.png" /></td>
                        </tr>
                        
                        <tr style="color: #000000">
                            <td align="left" colspan="2" style="width: 50%; height: 40%;

background-color: #ffffff">
                               
                                <div style="border-right: green 1px solid; border-top: green 1px

solid; z-index: 1; left: 400px; visibility: hidden; border-left: green 1px solid; width: 200px;

border-bottom: green 1px solid;position: absolute; top: 250px; background-color: #e2ebed"

id="helptypediv">
                                    <table style="height: 100%; width: 100%;">
                                            <tr style="background-color: #365f91">
                                                <td align="center" colspan="3">
                                                    <asp:Label ID="Label1" runat="server"

ForeColor="White" Text="Select Action"></asp:Label>&nbsp;</td>                                       

     </tr>
                                            <tr style="background-color: #95b3d7">
                                                <td colspan="3">
                                                    Link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                    <input id="radLink" type="radio"

name="choosebox" /></td>
                                            </tr>
                                            <tr style="background-color: #c6d9f1">
                                                <td colspan="3">
                                                    Popup&nbsp;&nbsp;
                                                    <input id="radPopup" type="radio"

name="choosebox" /></td>
                                            </tr>
                                            <tr>
                                                <td colspan="3">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="center" colspan="3">
                                                    <input id="Button2" type="button" value=" Ok "

/>
                                                    <input id="Button1"

onclick="document.getElementById('helptypediv').style.visibility='hidden'" type="button"

value="Cancel" />
                                                </td>
                                            </tr>
                                    </table>
                                 </div>
                                  <div style="width: 700px; height: 400px; overflow: auto;

font-family: Verdana, Tahoma, Helvetica, sans-serif; font-size: 11px; color: #000000;">
                                      <asp:Image ID="Image1" runat="server" /></div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </fieldset>
   </div>
</asp:Content>
--------------------------------------------------------------------
I am not very familiar with how displaying XML  contents.. I tried this way..
But stuck on that point please help me ..
I will very thankful for that..

Vishnu
0
vishnu108mishra
11/15/2007 11:40:52 AM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

0 Replies
1442 Views

Similar Articles

[PageSpeed] 57
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

XMl to XML
Hello,   I retrieved an XML from the dataset which retrieves data from the table in the database. I need to present the data  in a different structure. Is XSLT the way or are there any other options. please let me know. Thanks!! Yes XSLT is a good choice to convert xml file to other forms. You can take a look at XSLT Tutorial.Sincerely,Young Fang...

XML in, XML out
Hi All (and a happy holiday to those that will get a break), I am trying to read in an XML file of addresses. I need to remove all the address data from the file where code =~ /^000/ (there are none in the example data below). I need to reproduce that data 'as is', so I need to honour the tag structure, although the order of the tags doesn't need to be honoured. I have been trying to use XML::Simple and I had a go with XML::Smart but I haven't been able to get the results I want. My best effort is below (with XML::Simple). There are a couple of differences ...

Nested Repeater with XML Datasource
Hi all,I just cant get this to work. Simple scenario, I have a repeater to display my portfolio, I want to adda second repeater within the first to give a list of terms for which I have attained first page of Google. Sound simple enough? I cant get this right My XML Follows this structure 1 2 <portfolio> 3 <site> 4 <name>SITE NAME</name> 5 <uri>http://www.domain.co.uk</uri> 6 <thumbnail>~/images/thumbnails/thumbnail.jpg</thumbnail> 7 <image>~/images/thumbnails/picture.jp...

Linq To XML with nested xml file
I have the following nested XML file that I must work with:   <Authorizations> <Auth> <AuthNumber>AA12345</AuthNumber> <Lines> <Line> <SerNum>123456</SerNum> <Qty>1</Qty> <ShipDate>2008-05-15</ShipDate> <Carrier> <CarrierID>2</CarrierID> <CarrierShipDate>2008-05-17</CarrierShipDate> </Carrier> <Comm...

XML::Parser XML::DOM XML::XSLT
------_=_NextPart_001_01C6E0D0.3E27D77A Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Hi Craig and fellow VMS Perlers, You last wrote about this Fri 3/16/2001 11:24 AM, not counting your very helpful comments on Eisner/Decuserve more recently. One of my colleagues sent me an email requesting that I make XML::XSLT=20 available on VMS. perl 5.8.6, VMS 7.3-2, DECC 7.1 latest ACRTL (version 3) on Alpha XML::XSLT (version 0.48) depends on XML::Parser (version 2.34). This depends on expat (version 2.0.0). I built expat a...

Problem loading an xml string containing xml data into XML document
 Hi all,I have a problem loading an xml string containing xml response data returned by other server(spatial server) into XML document some times becoz the returned xml response contains special chars like <, >, ', etc.Is there any way to parse this XML response string before loading into XML document. Hi Bharath, if you can't find a ready made one you can write one yourself. Parse the string that you get for the elements that it would contain and inject the CDATA element between them to allow special character. example if you have a string <childNode>This con...

Problem with binding XMl data into nested repeater control??
Hello every one !How can I display data into repeater control..for eg. I have to display data in the following format from XMLrediffHomePage(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> ofFieldsToSupport/FieldToSupport for each <ScreenToSupport>.How can I bind repeater..Following is structure my XML file--------------------------------------------------------------------...

XML DataBinding to Nested Repeater
hi, I have a xml file and I want to bind it to a nested repeaters. but the problem I'm having is now I cannot give reference to xml nodes inside the repeater.. pls advice me .. the problem is in line 17. It's not able to render the CountrName from the tblCoutry xml node.. any idea's..????? HTML with line numbers. ---------------------------------- 01) <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="hdb_vb.WebForm1"%> 02) <%@ Import Namespace="System.Xml" %> 03) &l...

Problems writing to an XML file
I'm brand new to using XML (in fact this is my first project), so bear with me, I may need a little hand-holding. I'm trying to create a page which simply adds data to an existing xml file. Ultimately it will add the data from a form, but to keep things simple, I've been simply using pre-defined values. Originally I was able to get the script to write the xml exactly as I needed, however it would simply overwrite the existing file every time it was accessed. This is unacceptable, as it will be used to add data to one file, sort of like a mini database. So after much pain and gnashi...

XML to XML transform
Hi all, I have an XML file in which I just want to change a couple of values.  So, the end result is a new file with exactly the same XML structure.  I am new to XML and XSLT, so I thought I'd start off with something simple; I created an xsl file that would just copy the source directly across without modifying the values (I can do this later, once I have the first bit figured) - <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:con="http://eviware.com/soapui/config"><xsl:template match="/"...

Binding xml attributes to a repeater
This worked fine twice andthen starte throwing the error below any Ideas ? Dim doc As New XmlDocument()doc.Load(MapPath("clientslist.xml"))Dim nodes As XmlNodeList = doc.SelectNodes("Items/Item") Repeater1.DataSource = nodes Repeater1.DataBind() Object variable or With block variable not set. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object variable or With bloc...

sort xml in xml
Hi, How I can sort xml file in xml with VB.NetThanks,<?xml version="1.0" encoding="ISO-8859-1" ?>  <Liste>   <Form Famille="Administration" idXhtml="" idOffice="31574" nom="ADM" desc="" />   <Form Famille="Admini" idXhtml="" idOffice="31708" nom="ADM- 54 (2000)" desc="" />   <Form Famille="communication" idXhtml="" idOffice="31709" nom="ADM- 133 (2000)" desc="" />   <Form Famille="Admini" idXhtml="" idOffice="31710" nom="ADM- 9 (2000)" desc="" />   <Form Famille="Admini" idXhtml="" idOffice="31711" no...

XML
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi... Here's hoping someone can come to the rescue on this issue for me. I'm having a bear of a time figuring out why XML::Simple seems to want to make both the attribute and child element of a specific element into their own elements. I'm starting to wonder if the XML supplied as input is illegally formatted? As can be seen in my example here, the <platform_specific> element has an attribute named "attribute" and another named "platform". It also has a child element named <plat...

Inserting XML elements and attributes using XML DML
Hi,I'm trying to insert XML data into a SQL Server database XML column by using XML DML inside of a Stored Procedure. Thanks to http://msdn2.microsoft.com/en-us/library/ms175466.aspx I know how to insert new elements and attributes in different steps, but is there a way of combining these (inserting a new element and an attribute at the same time)? I found a solution to that:XMLColumn.modify('insert element Career {attribute lang {sql:variable("@Language")}} as first into (/CareerInformation)[1]')But now I'm trying to insert some values for this node and can't get it done. There's a lot of...

Web resources about - Problem with displaying attributes of xml into nested repeater..How to dispaly attributes of xml nested repeater..(if XML not followed hierarchical structure) - asp.net.xml-datasource

Hierarchical modulation - Wikipedia, the free encyclopedia
Hierarchical modulation , also called layered modulation , is one of the signal processing techniques for multiplexing and modulating multiple ...

Young graduates in an old-world hierarchical bureaucracy
The challenge for agencies is to develop leadership models that keep their best young staff interested in a career in government.

Yahoo killing off Yahoo after 20 years of hierarchical organization
... it was retiring its namesake product. In January 1994, Jerry Yang and David Filo, graduate students at Stanford University, created a hierarchical ...

Emma Thompson Mulls “Hierarchical” Hollywood, Ang Lee’s Brutal/Funny Notes, Oscars, Perms & More In BAFTA ...
... Britain – “Dustin Hoffman is as exquisite as Anthony Hopkins” – the star system in Hollywood “is not a good system.” Thompson called it “hierarchical” ...

Can A Big Old Hierarchical Bureaucracy Become A 21st Century Network?
Can a big old hierarchical bureaucracy become a 21st century networked firm? My interview with Rod Collins, former CEO of Blue Cross Blue Shield ...

Microliner Turns Your Twitter Conversations In Easy-to-Follow Hierarchical Trees
... which turns your Twitter conversations with multiple people from long sausages impossible to follow into logical, clearly organized hierarchical ...

Patent US6928433 - Automatic hierarchical categorization of music by metadata - Google Patents
... performed by software executing on the processor of a portable music playback device, that automatically files tracks according to hierarchical ...

Bossless Office? Companies Experiment With Non-Hierarchical Workplaces
... nobody's in charge, you don't work your way up from a cubicle to the corner office, and employees vote on who gets promoted? The non-hierarchical ...

Money as a Hierarchical System: Legal and Economic Perspectives
This Thursday is the first event of the Modern Money Network’s fall schedule , titled “ Money as a Hierarchical System: Legal and Economic Perspectives ...

Evading the strength–ductility trade-off dilemma in steel through gradient hierarchical nanotwins : Nature ...
The strength–ductility trade-off has been a long-standing dilemma in materials science. This has limited the potential of many structural materials, ...

Resources last updated: 1/14/2016 1:11:00 PM