Hi I really can't figure out what's wrong with my code
<asp:datagrid id="DataGrid1" runat="server"
AllowPaging="Tr ue"
AllowSorting="T rue"
AutoGenerateCol umns="True"
OnPageIndexChan ged="ChangeInde x">
<PagerStyle Mode="NumericPa ges"></PagerStyle>
....
private void Page_Load(objec t sender, System.EventArg s e)
{
if (!Page.IsPostBa ck)
{
this.sqlConnect ion1 = new SqlConnection (DBConstant.con nectionDB);
this.sqlConnect ion1.Open ();
HttpCookie cookie = Request.Cookies["hopitalID"];
strCookieValue = cookie.Value.To String(); fillData ();
DataGrid1.Curre ntPageIndex = 1;
}
}
private void fillData ()
{
string sql = "SELECT DISTINCT FACTURE.ID_NR_F ACTURE, " +
"ANALYSE.ID_ANA LYSE, FACTURE.DATE_FA CTURE " +
"AS DATE_FACTURE, PATIENT.PRENOM_ PATIENT, " +
"PATIENT.NOM_PA TIENT ,FACTURE.FACTUR E, " +
"FACTURE.ACQUIT TE FROM PATIENT, LABORATOIRE, " +
"ANALYSE, FACTURE WHERE ANALYSE.ID_ANAL YSE = " +
"FACTURE.ID_ANA LYSE AND ANALYSE.ID_PATI ENT = " +
"PATIENT.ID_PAT IENT AND ANALYSE.LABO_ID = " +
"LABORATOIRE.ID _LABORATOIRE AND " +
"LABORATOIRE.DE SIGNATION_LABOR ATOIRE = '" +
strCookieValue + "'" ;
DataSet ds = new DataSet ();
SqlDataAdapter adapter = new SqlDataAdapter (sql, this.sqlConnect ion1);
adapter.Fill (ds);
this.DataGrid1. DataSource = ds;
this.DataGrid1. DataBind();
}
protected void ChangeIndex(obj ect source,
System.Web.UI.W ebControls.Data GridPageChanged EventArgs e)
{
DataGrid1.Curre ntPageIndex = e.NewPageIndex;
fillData ();
}
really thanks in advance
<asp:datagrid id="DataGrid1" runat="server"
AllowPaging="Tr ue"
AllowSorting="T rue"
AutoGenerateCol umns="True"
OnPageIndexChan ged="ChangeInde x">
<PagerStyle Mode="NumericPa ges"></PagerStyle>
....
private void Page_Load(objec t sender, System.EventArg s e)
{
if (!Page.IsPostBa ck)
{
this.sqlConnect ion1 = new SqlConnection (DBConstant.con nectionDB);
this.sqlConnect ion1.Open ();
HttpCookie cookie = Request.Cookies["hopitalID"];
strCookieValue = cookie.Value.To String(); fillData ();
DataGrid1.Curre ntPageIndex = 1;
}
}
private void fillData ()
{
string sql = "SELECT DISTINCT FACTURE.ID_NR_F ACTURE, " +
"ANALYSE.ID_ANA LYSE, FACTURE.DATE_FA CTURE " +
"AS DATE_FACTURE, PATIENT.PRENOM_ PATIENT, " +
"PATIENT.NOM_PA TIENT ,FACTURE.FACTUR E, " +
"FACTURE.ACQUIT TE FROM PATIENT, LABORATOIRE, " +
"ANALYSE, FACTURE WHERE ANALYSE.ID_ANAL YSE = " +
"FACTURE.ID_ANA LYSE AND ANALYSE.ID_PATI ENT = " +
"PATIENT.ID_PAT IENT AND ANALYSE.LABO_ID = " +
"LABORATOIRE.ID _LABORATOIRE AND " +
"LABORATOIRE.DE SIGNATION_LABOR ATOIRE = '" +
strCookieValue + "'" ;
DataSet ds = new DataSet ();
SqlDataAdapter adapter = new SqlDataAdapter (sql, this.sqlConnect ion1);
adapter.Fill (ds);
this.DataGrid1. DataSource = ds;
this.DataGrid1. DataBind();
}
protected void ChangeIndex(obj ect source,
System.Web.UI.W ebControls.Data GridPageChanged EventArgs e)
{
DataGrid1.Curre ntPageIndex = e.NewPageIndex;
fillData ();
}
really thanks in advance
Comment