Hello
Having some issues with the Paging functionality of the
datagrid.
When on my development machine (server/client in one),
the paging works correctly. However, when I deploy to the
production IIS machine, the paging works correctly once
then does not proceed to the next page. (That is, it will
toggle between page 1 and 2 only). What's the problem?
Thanks for your help.
Troy
The code:
private void Page_Load(object sender, System.EventArgs e)
{
bindData();
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form
Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler
(this.Button1_Click);
this.dgResults.PageIndexChanged += new
System.Web.UI.WebControls.DataGridPageChangedEvent Handler
(this.dgResults_PageIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}#endregion
private void bindData()
{
SqlConnection cn = new SqlConnection("Initial
Catalog=Test;Data Source=Test;UID=uid;PWD=pwd");
cn.Open();
sSQL = "select col1, col2 from table";
// *** Load resultset ***
DataSet ds1 = new DataSet();
SqlDataAdapter daINV = new SqlDataAdapter(sSQL, cn);
daINV.Fill(ds1, "dt");
if (ds1.Tables["dt"].Rows.Count > 0)
{
dgResults.DataSource = ds1;
dgResults.DataBind();
dgResults.Visible=true;
}
// *** close connection ***
cn.Close();
}
private void dgResults_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
{
dgResults.CurrentPageIndex = e.NewPageIndex;
bindData();
}