CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!
Free 3 Months



Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.classifieds_starter_kit Tags:
Item Type: NewsGroup Date Entered: 5/16/2007 9:57:34 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 76 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
1 Items, 1 Pages 1 |< << Go >> >|
darkknight187
Asp.Net User
Problem using paging with a repeater in VB. . .5/16/2007 9:57:34 PM

0/0

I have been looking and looking trying to make this paging work, and no such luck.

I've tried many tutorials online and I think I found one that's really close to being right.

The tutorials original code is:

<table border="1">
        <asp:repeater id="rptParts" runat="server">
            <itemtemplate>
                <tr>
                    <td>
                        <%# DataBinder.Eval(Container.DataItem, "PartID") %>
                    </td>
                    <td>
                        <%# DataBinder.Eval(Container.DataItem, "Quantity") %>
                    </td>
                    <td>
                        <%# DataBinder.Eval(Container.DataItem, "Manufacturer") %>
                    </td>
                    <td>
                        <%# DataBinder.Eval(Container.DataItem, "Color") %>
                    </td>
                    <td>
                        <%# DataBinder.Eval(Container.DataItem, "Price") %>
                    </td>
                </tr>
            </itemtemplate>
        </asp:repeater>
        <tr>
            <td>
                <asp:button id="cmdPrev" runat="server" text="Prev"
                onclick="cmdPrev_Click"></asp:button>&nbsp;
                <asp:button id="cmdNext" runat="server" text="Next"
                onclick="cmdNext_Click"></asp:button>
            </td>
        </tr>
    </table>

    Private _CurrentPage As Integer

    Public Property CurrentPage() As Integer
        Get
            'look for current page in ViewState
            _CurrentPage = CInt(ViewState("CurrentPage"))
            Return _CurrentPage
        End Get
        Set(ByVal Value As Integer)
            viewstate("CurrentPage") = Value
        End Set
    End Property

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As _
    System.EventArgs) Handles MyBase.Load
        BindData()
    End Sub

    Sub BindData()
        'Read sample item info from XML document into a DataSet
        Dim ds As New DataSet()
        ds.ReadXml(Server.MapPath(".") & "\..\Xml\PartList.xml")

        ' Populate the repeater control with the Items DataSet
        Dim dsPaged As New PagedDataSource()
        dsPaged.DataSource = ds.Tables(0).DefaultView
        dsPaged.AllowPaging = True
        dsPaged.PageSize = 5

        dsPaged.CurrentPageIndex = CurrentPage

        'Disable Prev or Next buttons if necessary
        cmdPrev.Enabled = Not dsPaged.IsFirstPage
        cmdNext.Enabled = Not dsPaged.IsLastPage

        rptParts.DataSource = dsPaged
        rptParts.DataBind()

        'Dispose Items
        ds.Dispose()
    End Sub

    Sub cmdPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ' Set viewstate variable to the previous page
        CurrentPage -= 1

        ' Reload control
        BindData()
    End Sub

    Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ' Set viewstate variable to the previous page
        CurrentPage += 1

        ' Reload control
        BindData()
    End Sub

Right away it has an error with 2.0 for DataSet, so I changed it to Data.DataSet.

Then it looks like it's doing fine, but once loaded it keeps having an error as below.

 

 

Cannot find table 0.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Cannot find table 0.

Source Error:

Line 308:        ' Populate the repeater control with the Items DataSet
Line 309:        Dim dsPaged As New PagedDataSource()
Line 310:        dsPaged.DataSource = ds.Tables(0).DefaultView
Line 311:        dsPaged.AllowPaging = True
Line 312:        dsPaged.PageSize = 2

 

I can not figure out what to do with that line, no errors if I delete it, but it doesn't work then.

Any help would be appreciated, or if anyone has any code for a working paging system please post it.

 

Thank you in advance.

 

 


Be sure to visit www.detelli.com

And please remember to click ?Mark as Answer? on the post that helps you.
This can be beneficial to other community members reading the thread.
1 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Programming ASP.NET: Building Web Applications and Services Using C and VB.NET. Authors: Jesse Liberty, Dan Hurwitz, Pages: 988, Published: 2003
Visual Basic .NET Power Tools: Power Tools Authors: Evangelos Petroutsos, Richard Mansfield, Pages: 694, Published: 2003
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
Build Your Own ASP.NET 2.0 Web Site Using C# & VB: The Ultimate ASP.NET Begginner's Guide Authors: Cristian Darie, Zak Ruvalcaba, Pages: 689, Published: 2006
Build Your Own ASP.NET Website Using C# & VB.NET Authors: Zak Ruvalcaba, Pages: 746, Published: 2004
Beginning ASP.NET 2.0 Databases: From Novice to Professional Authors: Damien Foggon, Pages: 625, Published: 2006
Professional ASP.NET 2.0 Databases Authors: Thiru Thangarathinam, Pages: 504, Published: 2007
Sams Teach Yourself Visual Basic .NET Web Programming in 21 Days Authors: Peter G. Aitken, Philip Syme, Pages: 523, Published: 2001
Beginning ASP.NET 2.0 Databases: Beta Preview Authors: John Kauffman, Thiru Thangarathinam, Pages: 427, Published: 2005
The Book of VB.NET: .NET Insight for VB Developers Authors: Matthew MacDonald, Pages: 465, Published: 2002

Web:
[SOLVED] Paging in asp.net VB using the repeater control? - The ... [SOLVED] Paging in asp.net VB using the repeater control? ... If you have any problems with the registration process or your account login, ...
CodeProject: Paging with Repeater control in ASP.NET. Free source ... Paging with Repeater control in ASP.NET. VB, Windows, .NET 1.0, . .... how to group radio-buttons when using them in DataGrid, DataList, Repeater etc. ...
Paging Report Data in a DataList or Repeater Control : The ... If the latter approach is used, we must forgo using the ObjectDataSource and instead bind the paged data to the DataList or Repeater programmatically. ...
ASP.NET Tip: Creating Paging for a Repeater Control How do I implement paging within a Repeater control, you ask? ... NET, ASP, and Visual Basic. Send him your questions and feedback via e-mail at ...
display pictures using repeater or datalist with paging - VBForums display pictures using repeater or datalist with paging ASP.NET. ... the problem i got now is it doesnt go to the next page or even previous ...
(VB.NET) Paging with a Repeater : paging, repeater I have it running but with a problem. I get no error by my PagedDataSource isn't binding to my dataset so nothing is bound to my repeater. ...
Using QueryString for Pager on Repeater Control in VB Tutorial shows how to add page links to your Repeater control and make use of QueryString to move between pages using VB.NET.
Repeater paging with an SqlDataSource in ASP.Net Aug 17, 2007 ... That’s it - paging with a repeater using an SqlDataSource is implemented. ... yourself set up on forums.asp.net and post your problem there. ...
DotNetFreaks : LINQ to SQL Paging using GridView in VB and ASP.NE Sep 27, 2008 ... Using LINQ to Display and Filter XML Data in VB ( 08/16/08 ) ... Implementing a Pager with the Repeater Control VB ( 08/13/08 ) ...
CodeProject: Pager Control for Repeater, DataList, or an ... Re: using pager control for datalist in vb.net, member ... Now the problem has been fixed. the problem was not because of control. there was some logical ...




Search This Site:










number of ads: 50?

sending mails problem

video ads

search by all members with guests role

need help writing a dynamic image link . . .

how does login control work with classifieds_members

easy! how to get rid of ad count? turn "cars (3)" into just "cars"

where is the subcategory table? i am trying to implement a multiple dropdown

adding new pages

an icon for each category

hosting

netpets.co.nz - live site based on classifieds starter kit - feedback please!

very strange, bothersome bug!! wrong domain name displayed in "send ad as email text box

how is the page background maintained

packages and payment issues

4 0000's problem with the admin/ad.aspx

admin panel - textbox alignment

classified starter kit

site administration

add new searchable field

setting up classifieds starter kit on godaddy to send email

delete a classifieds user

classified ad with sql server 2000

synchronize members table from 2 classified applications

error -2147217900 - incorrect syntax near ','

repeater control

adding a new page in topmenurepeater

how to add another searchtextbox ?

problems with multiple namespaces

commercial sites with classified starter kit

  Privacy | Contact Us
All Times Are GMT