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 :

Dernière cellule d'un tableau dynamique ne s'affiche pas


Sujet :

ASP.NET

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2005
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Octobre 2005
    Messages : 46
    Points : 19
    Points
    19
    Par défaut Dernière cellule d'un tableau dynamique ne s'affiche pas
    Bonjour,

    Voici mon problème :

    J'utilise un tableau dynamique (classe Table) à laquelle j'ajoute des lignes et des cellules. Mais tout d'un coup, la dernière cellule ne s'affiche pas (l'image destructions8, mais je ne comprends pas pourquoi. Elles ne s'affiche que si j'enlève toute la partie /*** Rubrique pepiniere ***/

    Voici ce que j'ai essayé :

    1. J'ai affiché le count du contrôle de la cellule 8 de la rubrique "destructions" et j'obtiens bien "1" : Voir code ci-dessous

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    cell.Text = cell.Controls.Count.ToString();
    2. J'ai regardé à l'aide de l'outil "Web Developer" pour Firefox et il m'entoure bien la dernière cellule en rouge, mais elle est vide.

    Quelqu'un a une idée ?

    Merci beaucoup !

    Ci-dessous 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
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
     
     
                   Table maTable = new Table();
     
     
     
                    TableRow row = new TableRow();
                    TableCell cell = new TableCell();
                    HyperLink pic = new HyperLink();
     
                    /* Titre principal */
     
                    cell.Text = "Galerie de photos";
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    /* Rubrique destructions */
     
                    row = new TableRow();
                    cell = new TableCell();
                    cell.Text = "Destructions";
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions1.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions1_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions2.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions2_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions3.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions3_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
                    /* Destructions 2e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions4.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions4_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions5.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions5_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions6.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions6_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
                    /* Destructions 3e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions7.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions7_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions8.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions8_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
                    plhMedias.Controls.Add(maTable);
     
                    /********************************** Rubrique Pepiniere *****************/
                    maTable = new Table();
                    row = new TableRow();
                    cell = new TableCell();
                    cell.Text = "Pepinieres";
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere1.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere1_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere2.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere2_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere3.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere3_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
                    /* Pepiniere 2e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere4.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere4_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere5.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere5_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere6.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere6_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
     
                    /* Pepiniere 3e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere7.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere7_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);

  2. #2
    Membre habitué
    Inscrit en
    Décembre 2003
    Messages
    108
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Décembre 2003
    Messages : 108
    Points : 129
    Points
    129
    Par défaut
    j'avais eu soucis pareil, et je l'ai résolu en recréant mes objet à chaque fois
    donc dans ta deuxieme partie rubrique pepiniere,
    a lieu de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    maTable = new Table();
    row = new TableRow();
    cell = new TableCell();
    fais plutot
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    Table maTable2 = new Table();
    TableRow row2 = new TableRow();
    TableCell cell2 = new TableCell();
    je pense que c'est un problème de référence ou quelque chose du genre

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2005
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Octobre 2005
    Messages : 46
    Points : 19
    Points
    19
    Par défaut
    Salut mastervanou,

    Merci pour ta réponse prompte ! J'ai essayé ce que tu m'as conseillé mais cela n'a malheureusement pas fonctionné...

    Je rajoute aussi l'info que je créé mes tables (en l'occurence "maTable" et "maTable1" et que je les ajoute successivement à un placeholder.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    plhMedias.Controls.Add(maTable);
    plhMedias.Controls.Add(maTable1);
    Une autre suggestion ?

  4. #4
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Juillet 2007
    Messages
    1 277
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Réunion

    Informations forums :
    Inscription : Juillet 2007
    Messages : 1 277
    Points : 1 521
    Points
    1 521
    Par défaut
    Fait un effort pour factoriser ton code ... il est illisible et la plupart des lignes se ressemblent ... le tout pourrait très bien aller dans une ou plusieurs boucles, augmentant la lisibilité et le debug. Pour l'instant, il me donne mal à la tête donc je ne pourrais t'aider. La seule chose que j'ai vu, c'est qu'il manque quelques ColSpan déjà (tu as des lignes à 1 cellules, d'autres à 3 etc.).

  5. #5
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    7
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 7
    Points : 10
    Points
    10
    Par défaut
    Citation Envoyé par Amerok Voir le message
    Bonjour,

    Voici mon problème :

    J'utilise un tableau dynamique (classe Table) à laquelle j'ajoute des lignes et des cellules. Mais tout d'un coup, la dernière cellule ne s'affiche pas (l'image destructions8, mais je ne comprends pas pourquoi. Elles ne s'affiche que si j'enlève toute la partie /*** Rubrique pepiniere ***/

    Voici ce que j'ai essayé :

    1. J'ai affiché le count du contrôle de la cellule 8 de la rubrique "destructions" et j'obtiens bien "1" : Voir code ci-dessous

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    cell.Text = cell.Controls.Count.ToString();
    2. J'ai regardé à l'aide de l'outil "Web Developer" pour Firefox et il m'entoure bien la dernière cellule en rouge, mais elle est vide.

    Quelqu'un a une idée ?

    Merci beaucoup !

    Ci-dessous 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
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
     
     
                   Table maTable = new Table();
     
     
     
                    TableRow row = new TableRow();
                    TableCell cell = new TableCell();
                    HyperLink pic = new HyperLink();
     
                    /* Titre principal */
     
                    cell.Text = "Galerie de photos";
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    /* Rubrique destructions */
     
                    row = new TableRow();
                    cell = new TableCell();
                    cell.Text = "Destructions";
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions1.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions1_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions2.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions2_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions3.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions3_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
                    /* Destructions 2e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions4.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions4_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions5.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions5_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions6.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions6_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
                    /* Destructions 3e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions7.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions7_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/destructions/destructions8.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/destructions/small/destructions8_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
                    plhMedias.Controls.Add(maTable);
     
                    /********************************** Rubrique Pepiniere *****************/
                    maTable = new Table();
                    row = new TableRow();
                    cell = new TableCell();
                    cell.Text = "Pepinieres";
                    row.Cells.Add(cell);
                    maTable.Rows.Add(row);
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere1.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere1_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere2.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere2_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere3.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere3_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
                    /* Pepiniere 2e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere4.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere4_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere5.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere5_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere6.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere6_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
     
     
                    /* Pepiniere 3e ligne */
     
                    row = new TableRow();
                    cell = new TableCell();
                    pic = new HyperLink();
                    pic.Text = "MonLien";
                    pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere7.jpg";
                    pic.CssClass = "pic";
                    pic.Attributes.Add("rel", "group");
                    pic.ToolTip = "Image 1";
                    pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere7_s.jpg";
                    cell.Controls.Add(pic);
                    row.Cells.Add(cell);
     
                    maTable.Rows.Add(row);
    Bonjour,

    Essaie de déclarer une nouvelle table pour le bloc "Rubrique Pepiniere"
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     /***************** Rubrique Pepiniere **************/
                   Table maTablePep = new Table();

  6. #6
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2005
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Octobre 2005
    Messages : 46
    Points : 19
    Points
    19
    Par défaut
    Kaidan : je suis en train de développer, c'est la première couche, les boucles viendront dans un deuxième temps. Mon code est simple :

    lien => cellule => ligne

    Ceci 3 x pour faire 3 cellules par ligne

    Puis

    ligne => Tableau

    et ceci 3x

    Finalement : Tableau => Placeholder

    Mais si il te fait mal à la tête, il vaut mieux ne pas trop te faire souffrir...

    Chahir.ben : Merci, mais malheureusement j'ai déjà essayé et ça n'a pas fonctionné...

    Je vais peut-être reformuler ma question : pourquoi le dernier lien de la dernière cellule ne s'affiche-t-elle pas ?

  7. #7
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2009
    Messages
    7
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 7
    Points : 10
    Points
    10
    Par défaut
    Vérifie d'abord dans le rendu html si tu as bien la dernière ligne

    1.IE [click droit --> afficher la source] 2. Fx [click droit --> code source de la page]

    je te dirrai ça, car il se peux que tu as un html mal formé.

  8. #8
    Membre habitué
    Inscrit en
    Décembre 2003
    Messages
    108
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Décembre 2003
    Messages : 108
    Points : 129
    Points
    129
    Par défaut
    voilà un code qui marche je l'ai scindé en 2 fonctions en laissant ce que tu avais mis, comme dit plus haut il faut vraiment le rendre plus simple en évitant les répétition
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
     
     private void LoadTable1()
            {
                Table maTable = new Table();
     
     
     
                TableRow row = new TableRow();
                TableCell cell = new TableCell();
                HyperLink pic = new HyperLink();
     
                /* Titre principal */
     
                cell.Text = "Galerie de photos";
                row.Cells.Add(cell);
                maTable.Rows.Add(row);
     
                /* Rubrique destructions */
     
                row = new TableRow();
                cell = new TableCell();
                cell.Text = "Destructions";
                row.Cells.Add(cell);
                maTable.Rows.Add(row);
     
                row = new TableRow();
                cell = new TableCell();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions1.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions1_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions2.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions2_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions3.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions3_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                maTable.Rows.Add(row);
     
                /* Destructions 2e ligne */
     
                row = new TableRow();
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions4.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions4_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions5.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions5_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions6.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions6_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                maTable.Rows.Add(row);
     
                /* Destructions 3e ligne */
     
                row = new TableRow();
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions7.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions7_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/destructions/destructions8.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/destructions/small/destructions8_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                maTable.Rows.Add(row);
                plhMedias.Controls.Add(maTable);
     
     
     
            }
            private void LoadTable2()
            {
                /********************************** Rubrique Pepiniere *****************/
                Table maTable = new Table();
     
     
     
                TableRow row = new TableRow();
                TableCell cell = new TableCell();
                HyperLink pic = new HyperLink();
     
                row = new TableRow();
                cell = new TableCell();
                cell.Text = "Pepinieres";
                row.Cells.Add(cell);
                maTable.Rows.Add(row);
     
                row = new TableRow();
                cell = new TableCell();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere1.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere1_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere2.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere2_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere3.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere3_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                maTable.Rows.Add(row);
     
                /* Pepiniere 2e ligne */
     
                row = new TableRow();
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere4.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere4_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere5.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere5_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere6.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere6_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                maTable.Rows.Add(row);
     
     
                /* Pepiniere 3e ligne */
     
                row = new TableRow();
                cell = new TableCell();
                pic = new HyperLink();
                pic.Text = "MonLien";
                pic.NavigateUrl = "./images/galerie/pepiniere/pepiniere7.jpg";
                pic.CssClass = "pic";
                pic.Attributes.Add("rel", "group");
                pic.ToolTip = "Image 1";
                pic.ImageUrl = "./images/galerie/pepiniere/small/pepiniere7_s.jpg";
                cell.Controls.Add(pic);
                row.Cells.Add(cell);
     
                maTable.Rows.Add(row);
                plhMedias.Controls.Add(maTable);
            }
    tu n'a plus qu'a appeller
    LoadTable1();
    LoadTable2();

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2005
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Octobre 2005
    Messages : 46
    Points : 19
    Points
    19
    Par défaut
    Merci !

    Effectivement ça fonctionne ! Je note "résolu" bien que je ne sache toujours pas pourquoi ça ne fonctionnait pas...

    Autrement, ne vous inquiétez pas pour la redondance de code. Il s'agit uniquement d'un brouillon, je compte faire une fonction plus propre dans un deuxième temps...

    Et Chahir.ben, le html donnait <td></td> pour la cellule vide, donc il la créait bien mais elle était vide.

  10. #10
    Membre à l'essai
    Profil pro
    Inscrit en
    Octobre 2005
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Octobre 2005
    Messages : 46
    Points : 19
    Points
    19
    Par défaut
    Salut,

    Juste pour info, voici la version suivante (dans la prochaine je passerai le tableau de "Hyperlink" en paramètre)

    Merci pour votre aide !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
        private HyperLink creerLien(String nomDossier, String nomFichier, String infoBulle)
        {
            HyperLink picGalerie = new HyperLink();
     
            picGalerie.NavigateUrl = "./images/galerie/" + nomDossier + "/" + nomFichier + ".jpg";
            picGalerie.CssClass = "pic";
            picGalerie.Attributes.Add("rel", "group");
            picGalerie.ToolTip = infoBulle;
            picGalerie.ImageUrl = "./images/galerie/" + nomDossier + "/small/" + nomFichier + "_s.jpg";
     
            return picGalerie;
        }
    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
     
     
    private Table afficheGalerie1(String titreGalerie)
        {
     
            Table tabGalerie = new Table();
            TableRow ligne = new TableRow();
            TableCell cell = new TableCell();
            List<HyperLink> galerie = new List<HyperLink>();
     
            HyperLink pic1 = creerLien("destructions", "destructions1", "Ceci est un test 1");
            HyperLink pic2 = creerLien("destructions", "destructions2", "Ceci est un test 2");
            HyperLink pic3 = creerLien("destructions", "destructions3", "Ceci est un test 3");
            HyperLink pic4 = creerLien("destructions", "destructions4", "Ceci est un test 4");
            HyperLink pic5 = creerLien("destructions", "destructions5", "Ceci est un test 5");
            HyperLink pic6 = creerLien("destructions", "destructions6", "Ceci est un test 6");
            HyperLink pic7 = creerLien("destructions", "destructions7", "Ceci est un test 7");
            HyperLink pic8 = creerLien("destructions", "destructions8", "Ceci est un test 8");
     
            galerie.Add(pic1);
            galerie.Add(pic2);
            galerie.Add(pic3);
            galerie.Add(pic4);
            galerie.Add(pic5);
            galerie.Add(pic6);
            galerie.Add(pic7);
            galerie.Add(pic8);
     
            cell.Text = "titreGalerie";
            ligne.Cells.Add(cell);
            tabGalerie.Rows.Add(ligne);
     
            for (int i = 0; i < galerie.Count; i++)
            {
                if (i % 3 == 0)
                {
                    ligne = new TableRow();
                    tabGalerie.Rows.Add(ligne);
                }
     
                cell = new TableCell();
                cell.Controls.Add(galerie[i]);
                ligne.Cells.Add(cell);
            }
     
            tabGalerie.Rows.Add(ligne);
            plhMedias.Controls.Add(tabGalerie);
     
            return tabGalerie;
        }

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [XL-2010] Tableau dynamique ne s'affiche pas
    Par tbuhagiar dans le forum Macros et VBA Excel
    Réponses: 8
    Dernier message: 15/10/2013, 08h15
  2. [XL-97] Copier certaines cellules de la dernière ligne d'un tableau dynamique
    Par Estaque3394 dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 05/10/2010, 05h58
  3. [FPDF] Coordonnées des cellules d'un tableau dynamique
    Par Spectoo dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 22/04/2009, 08h48
  4. Modifier couleur de fond d'une cellule d'un tableau dynamiquement.
    Par fred61 dans le forum Général JavaScript
    Réponses: 8
    Dernier message: 27/03/2009, 02h19
  5. Dernière cellule d'un tableau
    Par cynoq dans le forum Macros et VBA Excel
    Réponses: 8
    Dernier message: 06/12/2007, 14h22

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