Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create a PagedDataSource with an XMLDataSource

Posted on 2008-06-21
4
947 Views
Last Modified: 2013-11-06
I want to create a pageddatasouce for an xml file ... here is the logic:

GalImages.xml looks like:

<?xml version="1.0"?>
<gallery>
  <album lgPath="\images\gallery\disney08\Family\" tnPath="\images\gallery\disney08\Family\" title="Family" description="Family" tn="\images\gallery\disney08\Family\APL  001.jpg">
    <img src="APL  001.jpg" title="APL  001.jpg" caption="APL  001.jpg" link="" target="_blank" pause="" />
    <img src="APL  020.jpg" title="APL  020.jpg" caption="APL  020.jpg" link="" target="_blank" pause="" />
  </album>
</gallery>

code behind:
        Dim XMLSource As New DataSet
        XMLSource.ReadXml(MapPath("~/images/gallery/fincher/GalImages.xml"))
        Dim objPds As New PagedDataSource()
        objPds.DataSource = XMLSource.Tables(0).DefaultView
        objPds.AllowPaging = True
        objPds.PageSize = 5
        objPds.CurrentPageIndex = CurrentPage
        xmlRepeat.DataSource = objPds
       'xmlRepeat.DataBind()

ASPX:
             <asp:Repeater ID="xmlRepeat" runat="server" >
                    <ItemTemplate>
                        <div class="blues" style="width:275px;height:320px;float:left;text-align:center;">
                            <%#Eval("src")%>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>

When i run it i get:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'src'.

How do i expose the src in the xml.

If i use a XMLDataSource with an XPATH="/gallery/album/img"  it works - but no paging

Thanks,

Gp.





0
Comment
Question by:timbersnow
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:kennethfine
ID: 21839517
Is there a reason why you're not using the ASP.NET 3.5 DataPager and ListView controls? It will save you the pain of implementing paging yourself, and you can work with a richer and more capable control than the simple Repeater. See here:
http://aspnet.4guysfromrolla.com/articles/021308-1.aspx
0
 
LVL 6

Accepted Solution

by:
kennethfine earned 500 total points
ID: 21839541
0
 

Author Comment

by:timbersnow
ID: 21840885
Dude - you rock.  I've not worked with ListView - and I've heard everybody screamin' about it - now i know why.

This was EXACTLY what i needed - especially the article.

Thank you.

BTW ... you probably could answer my other question i posted yesterday - would you mind taking a look at http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23504543.html?cid=473 

Thank you so much!

Cheers,

Gp.
0
 

Author Closing Comment

by:timbersnow
ID: 31469412
Dude - you rock.  I've not worked with ListView - and I've heard everybody screamin' about it - now i know why.

This was EXACTLY what i needed - especially the article.

Thank you.

BTW ... you probably could answer my other question i posted yesterday - would you mind taking a look at http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23504543.html?cid=473 

Thank you so much!

Cheers,

Gp.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question