like bill said:
Private Sub dataGrid2_PageIndexChanged(ByVal source As System.Object, ByVal
e As System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
DataGrid2.PageIndexChanged
DataGrid2.CurrentPageIndex = e.NewPageIndex
getData()
End Sub
*** When you do this, your program will throw an error when you delete the
last item on a datagrid page. Therefore when you load your datagrid
you must have the following: ***
Try 'need this try/catch when datagrid allows paging and the last item of a
"page" is deleted
DataGrid2.DataBind()
Catch
DataGrid2.CurrentPageIndex = DataGrid2.PageCount - 1
DataGrid2.DataBind()
End Try
"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:cW*******************@news-text.cableinet.net...
I've added a data grid to my page but the automatic paging feature doesn't
seem to be working.
The code I have on page load is as follows. Can anyone suggest why this
isn't working?
SqlDataAdapter adSales;
SqlConnection con = new
SqlConnection(System.Configuration.ConfigurationSe ttings.AppSettings.Get("Co nnectionString"));
adSales = new SqlDataAdapter("SELECT * FROM AllOrdersOverview ORDER BY
OrderDate ASC", con);
DataSet dsSales = new DataSet();
adSales.Fill(dsSales,"Sales");
grdSales.DataSource = dsSales;
grdSales.DataBind();
Page.DataBind();