OnPageIndexChanged="Grid_Change"
void Grid_Change(Object sender, DataGridPageChangedEventArgs e)
{
// For the DataGrid control to navigate to the correct page when
// paging is allowed, the CurrentPageIndex property must be updated
// programmatically. This process is usually accomplished in the
// event-handling method for the PageIndexChanged event. // Set CurrentPageIndex to the page the user clicked.
ItemsGrid.CurrentPageIndex = e.NewPageIndex; // Rebind the data to refresh the DataGrid control.
ItemsGrid.DataSource = CreateDataSource();
ItemsGrid.DataBind();
}
void Grid_Change(Object sender, DataGridPageChangedEventArgs e)
{
// For the DataGrid control to navigate to the correct page when
// paging is allowed, the CurrentPageIndex property must be updated
// programmatically. This process is usually accomplished in the
// event-handling method for the PageIndexChanged event. // Set CurrentPageIndex to the page the user clicked.
ItemsGrid.CurrentPageIndex = e.NewPageIndex; // Rebind the data to refresh the DataGrid control.
ItemsGrid.DataSource = CreateDataSource();
ItemsGrid.DataBind();
}
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataGrid1.DataBind();
}====================>>>>>>>>>>>>>>>>>>>>
public void DataGrid1_SelectedIndexChanged(object sender, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
this.BindGrid();
}
public void DataGrid1_SelectedIndexChanged(object sender, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataGrid1.DataBind();
}
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0123: 方法“ryb.list_huamn.DataGrid1_SelectedIndexChanged(object, System.Web.UI.WebControls.DataGridPageChangedEventArgs)”与委托“void System.EventHandler(object, System.EventArgs)”不匹配如何解决?
行 32:
<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" BackColor="White" CellPadding="3" GridLines="Vertical" ForeColor="Black" PageSize="8" AllowPaging="True" PagerStyle-HorizontalAlign="Right" AllowCustomPaging="True" OnSelectedIndexChanged="DataGrid1_SelectedIndexChanged">