Avatar of AidenA
AidenA
 asked on

implementing paging in xml data using a DataList (.NET 2.0)

Hi, I was looking the web for info on this but couldn't get it working. I got as far as below

html
 <asp:DataList  ID="DataList1"  runat="server" style="border:1px solid; border-color:#68affd;"></asp:DataList>

Open in new window


Codebehind: I've removed a bit of the code to just show the loading.
Private Sub LoadXML()

        Dim Items As New Data.DataSet()
        Items.ReadXml("http://ipaddress/news.xml")

        'creating the PagedDataSource instance....
        Dim pg As New PagedDataSource()
        Dim dv As New Data.DataView(Items.Tables(0))

        pg.DataSource = dv 

        pg.AllowPaging = True
        pg.PageSize = 1

        pg.CurrentPageIndex = 0
        'pg.CurrentPageIndex = CurrentIndex

        'The currentpage
        lblIndex.Text = "Page: " + (CurrentIndex + 1).ToString() + " of " + pg.PageCount.ToString()

        'Button status
        'Button1.Enabled = Not pg.IsFirstPage
        'Button2.Enabled = Not pg.IsLastPage


        'Binding pg to datalist
        DataList1.DataSource = pg 'dl is datalist
        DataList1.DataBind()

    End Sub

Open in new window


The problem that I'm having there is that nothing is returned at all even though the xml page does have data on it. What am I doing wrong there do you know?
ASP.NETXMLVisual Basic.NET

Avatar of undefined
Last Comment
AidenA

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Member_2_4913559

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
AidenA

ASKER
That was perfect, thanks!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23