Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Datagrid custom paging always loads page 1

Reply
Thread Tools

Datagrid custom paging always loads page 1

 
 
Julia B
Guest
Posts: n/a
 
      04-11-2006
Hi,

I've got a datagrid where I've set up custom paging, following instructions
in Help etc, however, although the virtualitemcount is correct (i.e. number
of pages shown is correct), whatever page I click on the first 10 dataset
items are always loaded. If anyone can help that would be great! Thanks in
advance....

Code below:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PartDbConnection.ConnectionString = Global.ConnectionString

'if the page isn't being loaded for the first time update the
datagrid
'with the session dataset
If Me.IsPostBack Then
PartDataSet1 = CType(Session("PartDataSet"), PartDataSet)
'otherwise update the datagrid with the database info
Else
startIndex = 0
PartDataAdapter.Fill(PartDataSet1)
Session("PartDataSet") = PartDataSet1
PartDataGrid.VirtualItemCount = PartDataSet1.Parts.Count
PartDataGrid.DataBind()
End If
End Sub

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

Private Sub PartDataGrid_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * PartDataGrid.PageSize
PartDataGrid.CurrentPageIndex = e.NewPageIndex
PartDataGrid.DataBind()
End Sub
 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      04-11-2006
The segment of code that you posted does not show the customization. It
looks like the default navigation with default buttons to me.

You might review those samples for how to customize the navigation:

http://www.societopia.net/samples/dataGrid_3c.aspx

http://msdn.microsoft.com/library/de...webcontrol.asp
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"Julia B" wrote:

> Hi,
>
> I've got a datagrid where I've set up custom paging, following instructions
> in Help etc, however, although the virtualitemcount is correct (i.e. number
> of pages shown is correct), whatever page I click on the first 10 dataset
> items are always loaded. If anyone can help that would be great! Thanks in
> advance....
>
> Code below:
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Me.PartDbConnection.ConnectionString = Global.ConnectionString
>
> 'if the page isn't being loaded for the first time update the
> datagrid
> 'with the session dataset
> If Me.IsPostBack Then
> PartDataSet1 = CType(Session("PartDataSet"), PartDataSet)
> 'otherwise update the datagrid with the database info
> Else
> startIndex = 0
> PartDataAdapter.Fill(PartDataSet1)
> Session("PartDataSet") = PartDataSet1
> PartDataGrid.VirtualItemCount = PartDataSet1.Parts.Count
> PartDataGrid.DataBind()
> End If
> End Sub
>
> Private Sub PartDataGrid_PageIndexChanged(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
> PartDataGrid.PageIndexChanged
> PartDataGrid.CurrentPageIndex = e.NewPageIndex
> PartDataGrid.DataBind()
> End Sub
>
> Private Sub PartDataGrid_Page(ByVal sender As Object, ByVal e As
> DataGridPageChangedEventArgs)
> startIndex = e.NewPageIndex * PartDataGrid.PageSize
> PartDataGrid.CurrentPageIndex = e.NewPageIndex
> PartDataGrid.DataBind()
> End Sub

 
Reply With Quote
 
 
 
 
Julia B
Guest
Posts: n/a
 
      04-11-2006
Thanks Philip

The Help documents I read weren't particularly intuitive or easy to
understand and I didn't find the walkthrough. I'll work through it and see if
I can get it to work.

Julia
"Phillip Williams" wrote:

> The segment of code that you posted does not show the customization. It
> looks like the default navigation with default buttons to me.
>
> You might review those samples for how to customize the navigation:
>
> http://www.societopia.net/samples/dataGrid_3c.aspx
>
> http://msdn.microsoft.com/library/de...webcontrol.asp
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Julia B" wrote:
>
> > Hi,
> >
> > I've got a datagrid where I've set up custom paging, following instructions
> > in Help etc, however, although the virtualitemcount is correct (i.e. number
> > of pages shown is correct), whatever page I click on the first 10 dataset
> > items are always loaded. If anyone can help that would be great! Thanks in
> > advance....
> >
> > Code below:
> >
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > Me.PartDbConnection.ConnectionString = Global.ConnectionString
> >
> > 'if the page isn't being loaded for the first time update the
> > datagrid
> > 'with the session dataset
> > If Me.IsPostBack Then
> > PartDataSet1 = CType(Session("PartDataSet"), PartDataSet)
> > 'otherwise update the datagrid with the database info
> > Else
> > startIndex = 0
> > PartDataAdapter.Fill(PartDataSet1)
> > Session("PartDataSet") = PartDataSet1
> > PartDataGrid.VirtualItemCount = PartDataSet1.Parts.Count
> > PartDataGrid.DataBind()
> > End If
> > End Sub
> >
> > Private Sub PartDataGrid_PageIndexChanged(ByVal source As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
> > PartDataGrid.PageIndexChanged
> > PartDataGrid.CurrentPageIndex = e.NewPageIndex
> > PartDataGrid.DataBind()
> > End Sub
> >
> > Private Sub PartDataGrid_Page(ByVal sender As Object, ByVal e As
> > DataGridPageChangedEventArgs)
> > startIndex = e.NewPageIndex * PartDataGrid.PageSize
> > PartDataGrid.CurrentPageIndex = e.NewPageIndex
> > PartDataGrid.DataBind()
> > End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging to the next page always gives me the first page cmrchs@gmail.com ASP .Net 5 07-23-2008 06:42 PM
FF always loads last sites that were open instead of home page ?? mc9799 Firefox 2 02-16-2006 05:05 PM
datagrid paging - customising paging style wh1974 ASP .Net 0 01-12-2005 03:48 PM
Custom Paging in Datagrid-Pagecount is always 1 anon ASP .Net 0 05-10-2004 04:38 PM
Custom paging problems - first page always displayed Oleg Ogurok ASP .Net Datagrid Control 0 07-08-2003 09:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57