|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagrid custom paging always loads page 1I'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.DataGridPageChangedEventArgs) 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 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/default.asp?url=/library/en-us/vbcon/html/vbtskspecifyingpagingbehaviorindatagridwebcontrol.asp Show quoteHide quote "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.DataGridPageChangedEventArgs) 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 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 Show quoteHide quote "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/default.asp?url=/library/en-us/vbcon/html/vbtskspecifyingpagingbehaviorindatagridwebcontrol.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.DataGridPageChangedEventArgs) 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
return url value
Show ***** only if have a password How do I debug apsx pages? Validation inside composite controls for ASP .NET 2.0 Datagrid cancel command does not work when adding new record How to set default values for fields in detailsview problem traping event in child control must click button twice for event to fire style question Webcontrol Alignment problem |
|||||||||||||||||||||||