RE: DataGrid Paging
From: ranganh (ranganh_at_discussions.microsoft.com)
Date: 08/26/04
- Next message: naijacoder naijacoder: "ASP.NET with ADirectory role based authentication"
- Previous message: SMG: "Re: Update Cache with database changes"
- In reply to: Alexandre Jaquet: "DataGrid Paging"
- Next in thread: Alexandre Jaquet: "RE: DataGrid Paging"
- Reply: Alexandre Jaquet: "RE: DataGrid Paging"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Aug 2004 23:07:07 -0700
Dear Alexandre,
Change your Paging method's access level to public, as follows:-
public void ChangeIndex(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
fillData ();
}
That should solve your problem.
Thanks.
"Alexandre Jaquet" wrote:
> 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: naijacoder naijacoder: "ASP.NET with ADirectory role based authentication"
- Previous message: SMG: "Re: Update Cache with database changes"
- In reply to: Alexandre Jaquet: "DataGrid Paging"
- Next in thread: Alexandre Jaquet: "RE: DataGrid Paging"
- Reply: Alexandre Jaquet: "RE: DataGrid Paging"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|