473,394 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Repeater and XmlDataSource

My repeater is not repeating any items.

I am trying to use an XmlDataSource to load a custom .sitemap file having
content similar to as follows:

<siteMap>
<siteMapNode title="Home" description="Home" url="~/default.aspx">
<siteMapNode title="Buy" description="Buy stuff"
url="~/Buy.aspx" />
<siteMapNode title="Sell" description="Sell stuff"
url="~/sell.aspx" />
</siteMapNode>
</siteMap>

I've put this file, called "Nav.sitemap", into the path
"~/App_Files/navXML/Nav.config".

In my TopNav.ascx file, I have a repeater as such:
<div>
<ul><asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate><li><a href='<%# XPath("@url") %>'><%# XPath("@title")
%></a></li></ItemTemplate>
</asp:Repeater>
</ul>
</div>

In the code-behind, I have something similar to the following:

protected void Page_Load(object sender, EventArgs e)
{
XmlDataSource xmlSource = new XmlDataSource();
xmlSource.DataFile = MapPath("~/App_Files/navXML/Nav.sitemap");
xmlSource.XPath = "/siteMap/siteMapNode/siteMapNode";
xmlSource.DataBind();
Repeater1.DataSource = xmlSource;
Repeater1.DataBind();
}

When I run this as posted on the machine I'm posting this newsgroup post (at
home), it works fine, but for some reason on the actual development server
at the office the output is blank. If I add a <HeaderTemplate />, the
repeater shows itself to be functional, but simply no items are displayed.
There is no error messages, the <ItemTemplate /simply never renders any
items. I've validated that the XPath string is identical to what's described
above. What could be some of the causes of this behavior? Any ideas??

Thanks,
Jon

Sep 14 '06 #1
0 1343

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mike | last post by:
can somebody please show me some code that will let me populate a checkboxlist from the xmldatasource, and have the text property set to the names in the xml file thanks you can also email me...
2
by: Eric | last post by:
Hello, I have a repeater control bound to an XmlDataSource. Works great. Now, I want to handle the ItemDataBound event--the e.Item.DataItem object in particular. Its type is...
3
by: Brian | last post by:
Using external XML, I'm trying to build a quiz, but I can't seem to specify the DataSource for the RadioButtonList within a Repeater ItemTemplate. I've tried a number of approaches, but I haven't...
2
by: Zulander | last post by:
hi, i am trying to put a session variable in the DataFile of the XmlDataSource, but for some reason i am getting: Server tags cannot contain <% ... %constructs. <asp:XmlDataSource...
2
by: sck10 | last post by:
Hello, How do you set the website proxy using the XmlDataSource control? Thanks, sck10
0
by: Will Chamberlain | last post by:
Before I start let me clarify that an XmlDataSource will not work for what I am doing. I am attempting to recreate a .NET version of binding Xml Data Islands to HTML Tables in IE 5.x+. You could...
0
by: pompair | last post by:
Hello, I'm making a quiz game for fun. I have an xml file like this: <?xml version="1.0" encoding="utf-8" ?> <results> <index>99</index> <answers>11</answers> <questions> <question id="1">
8
by: Wessel Troost | last post by:
We are using an XML data source in the Page_Load event of an ASP.NET page, like: protected void Page_Load(object sender, EventArgs e) { // Retrieve XML from web service for product idea in URL...
1
by: Sean | last post by:
I am experiencing a strange problem using the XMLDataSource and DataList controls which I cannot seem to resolve. I am using the controls to read and display a variety of RSS feeds. On my local...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.