By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,084 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,084 IT Pros & Developers. It's quick & easy.

Datagrid and Pagging

P: n/a
Hi,
I'm using a Datagrid that I fill with a Dataset but
when I configure the paging with the Navigation Buttons I
can't put them working, I've tried both methods (Next,
Previous and Page Numbers) when I click on the Next link
of the navigation buttons I see on status bar the
folowing code -> javascript:__doPostBack('Datagrid1$_ctl9
$_ctl1','') but nothing happens on Datagrid.

I've configured the datagrid for 5 rows and Dataset
returns about 20 rows.

Thanks in advance
Ric
..
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You have to handle the page changing event in the datagrid, and write your
own code to advance to the next page.

"Ricardo Manuel" <an******@hotmail.com> wrote in message
news:05****************************@phx.gbl...
Hi,
I'm using a Datagrid that I fill with a Dataset but
when I configure the paging with the Navigation Buttons I
can't put them working, I've tried both methods (Next,
Previous and Page Numbers) when I click on the Next link
of the navigation buttons I see on status bar the
folowing code -> javascript:__doPostBack('Datagrid1$_ctl9
$_ctl1','') but nothing happens on Datagrid.

I've configured the datagrid for 5 rows and Dataset
returns about 20 rows.

Thanks in advance
Ric
.

Jul 19 '05 #2

P: n/a
Just because you've changed the DataGrid's interface to support or "Enable"
paging, doesn't mean that the functionality is automatic, it just means that
you'll have the buttons (or hyperlinks) that a user can click. You still
must write the code for the PageIndexChanged event that fires when someone
clicks the paging button (or hyperlink).

See code below (by the way the same concept is true when you enable sorting
in the DataGrid - - I've included that code as well):

Private Sub dg_PageIndexChanged(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
dg.PageIndexChanged
dg.CurrentPageIndex = e.NewPageIndex
dg.DataBind()
End Sub

Private Sub dg_SortCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles
dg.SortCommand
Dim dv As New DataView(dsCusts.Tables(0))
dv.Sort = e.SortExpression
dg.DataSource = dv
dg.DataBind()
End Sub

"Ricardo Manuel" <an******@hotmail.com> wrote in message
news:05****************************@phx.gbl...
Hi,
I'm using a Datagrid that I fill with a Dataset but
when I configure the paging with the Navigation Buttons I
can't put them working, I've tried both methods (Next,
Previous and Page Numbers) when I click on the Next link
of the navigation buttons I see on status bar the
folowing code -> javascript:__doPostBack('Datagrid1$_ctl9
$_ctl1','') but nothing happens on Datagrid.

I've configured the datagrid for 5 rows and Dataset
returns about 20 rows.

Thanks in advance
Ric
.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.