Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't page with datagrid in vb.net

Status
Not open for further replies.

tzigone

MIS
Aug 11, 2003
42
TR
Hi,
I am trying to do datagrid paging like this:
<asp:DataGrid id=&quot;DataGrid1&quot; style=&quot;Z-INDEX: 101; LEFT: 200px; POSITION: absolute; TOP: 96px&quot;
runat=&quot;server&quot; Width=&quot;192px&quot; Height=&quot;80px&quot; BorderColor=&quot;#CC9966&quot; BorderStyle=&quot;None&quot; BorderWidth=&quot;1px&quot;
BackColor=&quot;White&quot; CellPadding=&quot;4&quot; AllowCustomPaging=&quot;True&quot; PageSize=&quot;5&quot; AllowPaging=&quot;True&quot;>
and then in event procedure i write
Private Sub DataGrid1_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex


After binding etc, the result of the aspx page shows only one page of resultlist although it should show 2 pages.I am doing paging with mode=numbers.
what could be the problem?
 
Did you add the following event?

Sub dg_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dg.PageIndexChanged
dg.CurrentPageIndex = e.NewPageIndex
LoadGrid() 'Some code that binds the grid
End Sub

Hope everyone is having a great day!

Thanks - Jennifer
 
i add pageindexchanged event following code
DataGrid1.DataSource = ds
DataGrid1.DataBind()
i made ds a private dataset and delete
DataGrid1.DataSource = ds
DataGrid1.DataBind()from pageload event. as a result nothing appears in the browser.
 
tzigone,

I am sorry I didn't read your initial post properly.

After setting the CurrentPageIndex then you just call the same code that initially bound the code.

Hope this helps, and sorry for the confusion.

Hope everyone is having a great day!

Thanks - Jennifer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top