DataGrid Paging
From: Alexandre Jaquet (AlexandreJaquet_at_discussions.microsoft.com)
Date: 08/26/04
- Next message: Frank Mamone: "Re: Update Cache with database changes"
- Previous message: Unknown-Services: "Re: Repeater LinkButton"
- Next in thread: ranganh: "RE: DataGrid Paging"
- Reply: ranganh: "RE: DataGrid Paging"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Aug 2004 19:51:02 -0700
Hi I really can't figure out what's wrong with my code
<asp:datagrid id="DataGrid1" runat="server"
AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="True"
OnPageIndexChanged="ChangeIndex">
<PagerStyle Mode="NumericPages"></PagerStyle>
...
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
this.sqlConnection1 = new SqlConnection (DBConstant.connectionDB);
this.sqlConnection1.Open ();
HttpCookie cookie = Request.Cookies["hopitalID"];
strCookieValue = cookie.Value.ToString(); fillData ();
DataGrid1.CurrentPageIndex = 1;
}
}
private void fillData ()
{
string sql = "SELECT DISTINCT FACTURE.ID_NR_FACTURE, " +
"ANALYSE.ID_ANALYSE, FACTURE.DATE_FACTURE " +
"AS DATE_FACTURE, PATIENT.PRENOM_PATIENT, " +
"PATIENT.NOM_PATIENT ,FACTURE.FACTURE, " +
"FACTURE.ACQUITTE FROM PATIENT, LABORATOIRE, " +
"ANALYSE, FACTURE WHERE ANALYSE.ID_ANALYSE = " +
"FACTURE.ID_ANALYSE AND ANALYSE.ID_PATIENT = " +
"PATIENT.ID_PATIENT AND ANALYSE.LABO_ID = " +
"LABORATOIRE.ID_LABORATOIRE AND " +
"LABORATOIRE.DESIGNATION_LABORATOIRE = '" +
strCookieValue + "'" ;
DataSet ds = new DataSet ();
SqlDataAdapter adapter = new SqlDataAdapter (sql, this.sqlConnection1);
adapter.Fill (ds);
this.DataGrid1.DataSource = ds;
this.DataGrid1.DataBind();
}
protected void ChangeIndex(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
fillData ();
}
really thanks in advance
- Next message: Frank Mamone: "Re: Update Cache with database changes"
- Previous message: Unknown-Services: "Re: Repeater LinkButton"
- Next in thread: ranganh: "RE: DataGrid Paging"
- Reply: ranganh: "RE: DataGrid Paging"
- Messages sorted by: [ date ] [ thread ]