Paging page for view recordset

5/21/2013 10:30:41 PM
Total Posts 11

Paging page for view recordset

Dear User Forum and Admin

May You help me script of Paging page for view recordset

in asp.net vb.net programming, please

thank you very much for your help

 

best regards

 

bahar

5/22/2013 1:13:32 AM
MVP
Total Posts 323

Re: Paging page for view recordset

A simple example would be as follows:

    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If (Not IsPostBack) Then
            gridView1.AllowPaging = True
            gridView1.PageSize = 2
            gridView1.DataSource = map("states").Recordset
            gridView1.DataBind()
        End If

    End Sub

    Private Sub gridView1_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
        gridView1.PageIndex = e.NewPageIndex
        gridView1.DataSource = map("states").Recordset
        gridView1.DataBind()
    End Sub

But if the Recordset has been obtained as a result of a query, you will have to re-execute exactly the same query in PageIndexChanging. Thereby, the parameters of the last query should be saved somewhere in the ViewState or in a Session variable.

Also, if AJAX(UpdatePanel) is used, the GridView control should be placed in a separate UpdatePanel.