Solved

Create a PagedDataSource with an XMLDataSource

Posted on 2008-06-21
4
950 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
[X]
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
  • 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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 perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

707 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