Link to home
Start Free TrialLog in
Avatar of pprasadravi
pprasadravi

asked on

Repeater xpathnodeiterator

Hi


i want to bin xpathnodeiterator to repeater control.
Is it possible if yes can you pleade guide me
Thanks
Ravi
Avatar of AerosSaga
AerosSaga

<%@ Page Language="C#" autoEventWireup="false"%>
<%@ Import Namespace="System.Xml" %>

<script language="c#" runat="server">

override protected void OnInit(EventArgs e)
{
    base.OnInit(e);
    this.Load += new System.EventHandler(this.Page_Load);
}

private void Page_Load(object sender, System.EventArgs e)
{
    XmlDocument d = new XmlDocument();
    d.LoadXml("<root><county><id>1</id><name>FULTON</name><state>GA</state></county><county><id>2</id><name>DE
KALB</name><state>GA</state></county></root>");

    myRepeater.DataSource = d.SelectNodes("//county");
    myRepeater.DataBind();
}
   
</script>

<html>
<body>

<h2>Counties List</h2>

<asp:Repeater id="myRepeater" runat="server">
<HeaderTemplate>
<table>
<tr><th>ID</th><th>County Name</th><th>State Name</th></tr>
</HeaderTemplate>
    <ItemTemplate>
     <tr>
     <td><%# ((XmlNode)Container.DataItem).ChildNodes[0].InnerText %></td>
     </tr>
    </ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

</body>
</html>
Avatar of pprasadravi

ASKER

but i want to bind with xpathnodeiterator
ASKER CERTIFIED SOLUTION
Avatar of w_shaila
w_shaila

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial