A
anonieko
Assuming that paging is enable. The most common mistake are:
1. Forgetting to check for postback. Use IsPostBack propert of page.
2. Forgetting to code PageIndexChanged event .
3. *Important* Not putting the correct order of statements in that
event. First, set the CurrentPageIndex . Then, bind.
private void Page_Load(object sender, System.EventArgs e)
{
if ( !Page.IsPostBack )
{
BindGrid();
}
}
private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
BindGrid();
}
private void BindGrid()
{
oracleDataAdapter1.Fill(groupDS1);
DataGrid1.DataSource = groupDS1.Tables[0].DefaultView;
DataGrid1.DataBind();
}
1. Forgetting to check for postback. Use IsPostBack propert of page.
2. Forgetting to code PageIndexChanged event .
3. *Important* Not putting the correct order of statements in that
event. First, set the CurrentPageIndex . Then, bind.
private void Page_Load(object sender, System.EventArgs e)
{
if ( !Page.IsPostBack )
{
BindGrid();
}
}
private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
BindGrid();
}
private void BindGrid()
{
oracleDataAdapter1.Fill(groupDS1);
DataGrid1.DataSource = groupDS1.Tables[0].DefaultView;
DataGrid1.DataBind();
}