A
Anonieko Ramos
Question: Why can't I enable paging in Datagrid?
Answer:
You must check 'AllowPaging'
You must add code to handle the PageIndexChanged Event.
This is the partial code...
// If you have dragged and dropped the oracle connection to
design surface,
// the InitializeComponent() will create the following.
// 1. Connection
// 2. Adapter
// 3. Adapter's Delete, Insert, Update commands.
//
private void DataGrid1_Load(object sender, System.EventArgs e)
{
if ( ! Page.IsPostBack )
{
// First Time
BindData();
}
}
private void BindData()
{
oracleConnection1.Open();
DataSet ds = new DataSet();
oracleDataAdapter1.Fill(ds, "AccountDomain");
DataGrid1.DataSource = ds.Tables[0].DefaultView;
DataGrid1.DataBind();
oracleConnection1.Close();
}
private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
BindData();
}
Answer:
You must check 'AllowPaging'
You must add code to handle the PageIndexChanged Event.
This is the partial code...
// If you have dragged and dropped the oracle connection to
design surface,
// the InitializeComponent() will create the following.
// 1. Connection
// 2. Adapter
// 3. Adapter's Delete, Insert, Update commands.
//
private void DataGrid1_Load(object sender, System.EventArgs e)
{
if ( ! Page.IsPostBack )
{
// First Time
BindData();
}
}
private void BindData()
{
oracleConnection1.Open();
DataSet ds = new DataSet();
oracleDataAdapter1.Fill(ds, "AccountDomain");
DataGrid1.DataSource = ds.Tables[0].DefaultView;
DataGrid1.DataBind();
oracleConnection1.Close();
}
private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
BindData();
}