IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP.NET Discussion :

la pagination ca vous dis quelque chose.


Sujet :

ASP.NET

  1. #1
    Membre régulier
    Inscrit en
    Février 2007
    Messages
    239
    Détails du profil
    Informations forums :
    Inscription : Février 2007
    Messages : 239
    Points : 70
    Points
    70
    Par défaut la pagination ca vous dis quelque chose.
    Salut tous le monde voici d'abord mon code :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
     
    <form id=AdminDestForm method=post runat="server">
        <fieldset id=fsListObjet runat="server"><legend>Liste des objets</legend>
    	<asp:datagrid id=dgObjet runat="server" width="100%" horizontalalign="Center" allowsorting="false" allowpaging="True" allowcustompaging="True" onpageindexchanged=dgObjet autogeneratecolumns="False" cellpadding="3" gridlines="Horizontal" itemstyle-height="30">
    	<alternatingitemstyle wrap="False" cssclass="Tableau_content_alternate"></alternatingitemstyle>
    	<itemstyle wrap="False" height="30px" cssclass="Tableau_content"></itemstyle>
         <headerstyle cssclass="Tableau_top"></headerstyle>
         <columns>
    	<asp:boundcolumn datafield="macro" sortexpression="macro" headertext="macro"><headerstyle width="15%"></headerstyle>
    	</asp:boundcolumn>
    	<asp:boundcolumn datafield="no" sortexpression="no" headertext="Numéro de l'état"><headerstyle width="15%"></headerstyle>
    	</asp:boundcolumn>
    	<asp:boundcolumn datafield="dest" sortexpression="dest" headertext="Nom du destinataire"><headerstyle width="20%"></headerstyle>
    	</asp:boundcolumn>
    	<asp:boundcolumn datafield="D" sortexpression="D" headertext="Mode d'envoi"><headerstyle width="15%"></headerstyle>
    	</asp:boundcolumn>
    	<asp:boundcolumn datafield="C" sortexpression="C" headertext="Type de compression"><headerstyle width="15%"></headerstyle>
    	</asp:boundcolumn>
    	<asp:boundcolumn datafield="P" sortexpression="P" headertext="Protection"><headerstyle width="15%"></headerstyle>
    	</asp:boundcolumn>
                  <asp:templatecolumn><headerstyle width="5%"></headerstyle>
    	</asp:templatecolumn>
    	</columns>
    <pagerstyle cssclass="Tableau_top" mode="NumericPages"></pagerstyle>
    </asp:datagrid>
    </fieldset> 
    </form>

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
     
    private void Page_Load(object sender, System.EventArgs e) 
    		{
    			// Déclaration de mon DataTable.
    			// Déclaration de mon DataRows.
    			// Déclaration de mon DataView.
     
    			DataTable Dt = new DataTable();
     
    			// Ajout des entêtes de colonnes a mon DataTable.
    			Dt.Columns.Add(new DataColumn("Macro",typeof (string)));
    			Dt.Columns.Add(new DataColumn("No",typeof (string)));
    			Dt.Columns.Add(new DataColumn("Dest",typeof (string)));
    			Dt.Columns.Add(new DataColumn("D",typeof (string)));
    			Dt.Columns.Add(new DataColumn("C",typeof (string)));
    			Dt.Columns.Add(new DataColumn("P",typeof (string)));
     
     
    			ArrayList listeLigne = new ArrayList() ;
    			//Lecture de mon fichier
    			string ligne = " " ;
    			StreamReader sr=File.OpenText(@"C:\Documents and Settings\i.abarkan\Desktop\REF\SI4DEST.dat") ;
     
    			while ((ligne = sr.ReadLine()) != null)
    			{
    				if (ligne != null && ligne != string.Empty) 
    				{
    					string [] listeChaine = ligne.Split('\t') ;
    					listeLigne.Add(listeChaine) ;
    					string machaine = listeLigne.ToString();
    				}
    			}
     
    			for (int i = 0 ; i < listeLigne.Count; i++ )
    			{
    				DataRow Dr = Dt.NewRow();
    				string [] tmp = (string[]) listeLigne[i];
    				for(int j = 0; j < tmp.GetLength(0); j++)
    				{
    					Dr[j] = tmp[j];
    				}
    				Dt.Rows.Add(Dr);
    			}
    			// Association de mon DataView a mon Datagrid.
    			DataView Dv = new DataView(Dt);
    			dgObjet.DataSource = Dv;
    			dgObjet.DataBind();
     
     
    		if (!IsPostBack) 
    		{
    		startIndex=0;
    		dgObjet.VirtualItemCount=200;
    		}
    		BindGrid();
    	}
     
    }
     
     
     
     
           		void dgObjet_Page(Object sender, DataGridPageChangedEventArgs e) 
    		{
    			startIndex = e.NewPageIndex * dgObjet.PageSize;
    			dgObjet.CurrentPageIndex = e.NewPageIndex;
    			BindGrid();
    		}
     
    		void BindGrid() 
    		{
    			dgObjet.DataSource = CreateDataSource();
    			dgObjet.DataBind();
    			ShowStats();
    		}
     
    		void ShowStats() 
    		{
    			lblEnabled.Text = "AllowPaging est " + dgObjet.AllowPaging;
    			lblCustom.Text = "AllowCustomPaging est " + dgObjet.AllowCustomPaging;
    			lblCurrentIndex.Text = "CurrentPageIndex est " + dgObjet.CurrentPageIndex;
    			lblPageCount.Text = "PageCount est " + dgObjet.PageCount;
    			lblVirtual.Text = "VirtualItemCount est " + dgObjet.VirtualItemCount;
    			lblPageSize.Text = "PageSize est " + dgObjet.PageSize;
     
    		}
     
     
        }

    Je ne sais pas pourquoi dans ma page aspx la pagination de mon DataGrid ne marche pas.

  2. #2
    Membre expérimenté Avatar de Mose
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    1 143
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 1 143
    Points : 1 379
    Points
    1 379
    Par défaut
    Et avec le paging normal ça marche ?

Discussions similaires

  1. Egroupware 1.8, ça vous dit quelque chose?
    Par Swohard dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 5
    Dernier message: 19/09/2012, 15h58
  2. Si vous aviez quelque chose à reprocher à Haskell
    Par limestrael dans le forum Haskell
    Réponses: 30
    Dernier message: 06/01/2011, 12h49
  3. L'ergonomie, ça vous dit quelque chose ?
    Par benwit dans le forum ALM
    Réponses: 14
    Dernier message: 15/07/2010, 09h15
  4. NIIT cela vous dit quelque chose ?
    Par shadowkillah dans le forum Etudes
    Réponses: 1
    Dernier message: 01/12/2009, 14h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo