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 :

Ajout de lignes a un asp:Table


Sujet :

ASP.NET

  1. #1
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2002
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Août 2002
    Messages : 6
    Par défaut Ajout de lignes a un asp:Table
    Bonjour à tous,

    j'ai un bout de code qui ne marche pas bien et je ne vois pas d'où me viens l'erreur.

    situation:

    j'ai deux (2) controles asp:Table ("tbListFrais" et "tbDetailFrais") dont la declaration est la suivante.

    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
    <asp:Table ID="tbListFrais" runat="server" >
       <asp:TableRow>
           <asp:TableCell> 
                 <asp:Table ID="tbDetailFrais" runat="server">
                          <asp:TableRow>
                               <asp:TableCell Text="Taux :" />
                               <asp:TableCell ID="iDTaux" Font-Bold="True" />
                               <asp:TableCell Text="Date Remise :" />
                               <asp:TableCell ID="iDDateRemise" />
                               <asp:TableCell RowSpan="2" id="iDBoutonFixeFrais">
                                       <asp:Button ID="cmdCalculerFrais" runat="server" Text="Calculer" />
                                </asp:TableCell>
                         </asp:TableRow>
                         <asp:TableRow>
                               <asp:TableCell Text="Date Echeance :" />
                               <asp:TableCell ID="iDDateEcheance" Font-Bold="True" />
                               <asp:TableCell Text="Nbre De Jour :" />
                               <asp:TableCell ID="iDNombreDeJour" Font-Bold="True" />
                          </asp:TableRow>
                     </asp:Table>
                </asp:TableCell>
            </asp:TableRow>
       </asp:Table>
    Attente:
    je voudrais au chargement de ma feuille afficher "tbDetailFrais" autant de fois qu'il y a d'enregistrements dans ma requette select. "tbDetailFrais" est toujours le contenu des lignes de "tbListFrais".
    à l'execution je n'ai qu'un seul "tbDetailFrais" alors que mon enregistrement en compte 3.

    quelqu'un peut il m'aider.

  2. #2
    Modérateur

    Homme Profil pro
    Chef de projet NTIC
    Inscrit en
    Avril 2007
    Messages
    1 996
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Chef de projet NTIC
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2007
    Messages : 1 996
    Par défaut
    Mets ton code dans une balise [CODE] stp.

    Si tu veux générer plusieurs lignes, il faut que tu construises dynamiquement ton tableau dans ton code behind pour générer autant de lignes que d'enregistrements.

    N'as-tu pas plutôt intérêt à utiliser une gridview plutôt qu'une Table ?

  3. #3
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2002
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Août 2002
    Messages : 6
    Par défaut
    merci je met mon code dans la balise [code].

    voici le code behind (vb.net) que j'ai construit.

    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
    Public Function BuildTableauFrais(ByRef tbLFrais As Table, ByVal tbDFrais As Table, ByVal sNumBorderau As String) As Boolean
                Dim rSql As String = ""
                Dim da As New DBAccess
                Dim ds As New DataSet
                Dim bln As Boolean
     
                da.Connect()
     
                ds = da.ExecuteDataSet(rSql)
     
                If (ds.Tables.Count > 0) Then
                    If (ds.Tables(0).Rows.Count > 0) Then
                        Dim tbRow As DataRow
                        Dim sCodeBk As String =""
     
                        For Each tbRow In ds.Tables(0).Rows
     
                            Dim lngCom As Double = 0
                            Dim lngTPS As Double = 0
                            Dim lngTotalInteret As Double = 0
                            Dim lngMontantAgio As Double = 0
     
                            ' Generate rows and cells. 
                            Dim tbSave As New Table
                            tbSave = tbDFrais
                            Dim tbRw As New TableRow
                            For Each tbRw In tbSave.Rows
                                Dim tbCel As New TableCell
                                For Each tbCel In tbRw.Cells
                                    If tbCel.ID = "iDTaux" Then
                                        tbCel.Text = tbRow.Item("TAUX").ToString
                                    ElseIf tbCel.ID = "iDDateRemise" Then
                                        tbCel.Text = FormatDateTime(tbRow.Item("DATE_RECEPTION"), DateFormat.ShortDate)
                                    ElseIf tbCel.ID = "iDDateEcheance" Then
                                        tbCel.Text = FormatDateTime(dDateEcheance, DateFormat.ShortDate)
                                    ElseIf tbCel.ID = "iDNombreDeJour" Then
                                        tbCel.Text = iNbreJour.ToString
                                    ElseIf tbCel.ID = "iDMontant" Then
                                        tbCel.Text = FormatNumber(tbRow.Item("MONTANT_EFFET"), 0, , , TriState.True)
                                    ElseIf tbCel.ID = "iDCommissonBorderau" Then
                                        tbCel.Text = FormatNumber(lngCom, 0, , , TriState.True) 'FormatNumber(lngCom, 0, , , TriState.True)
                                    ElseIf tbCel.ID = "iDFraisFixe" Then
                                        tbCel.Text = "1 500"
                                    ElseIf tbCel.ID = "iDMontantAgio" Then
                                        tbCel.Text = FormatNumber(lngMontantAgio, 0, , , TriState.True)
                                    ElseIf tbCel.ID = "iDTps" Then
                                        tbCel.Text = FormatNumber(lngTPS, 0, , , TriState.True)
                                    ElseIf tbCel.ID = "iDAgio" Then
                                        If tbRow.Item("AGIO") = 1 Then tbCel.Text = "Agio à la charge du tire"
                                    ElseIf tbCel.ID = "iDTotalInteret" Then
                                        tbCel.Text = FormatNumber(lngTotalInteret, 0, , , TriState.True)
                                    ElseIf tbCel.ID = "iDBoutonFixeFrais" Then
                                        'Dim cmdB As New Button
                                        'cmdB.CommandName = tbRow.Item("REFERENCE").ToString
                                        'cmdB.ID = "cmdFixeFraix"
                                        'tbCel.Controls.Add(cmdB)
                                    ElseIf tbCel.ID = "iDHeader" Then
                                        tbCel.Text = "FRAIS EFFET REF: [" & tbRow.Item("REFERENCE").ToString & "]"
                                    End If
                                Next
                            Next
                            Dim tempRow As New TableRow()
                            Dim tempCell As New TableCell()
                            Dim tempTB As New Table
                            tempTB = tbSave
                            tempTB.ID = tbRow.Item("REFERENCE").ToString
                            tempCell.Controls.Add(tempTB)
                            tempRow.Cells.Add(tempCell)
     
                            tbLFrais.Controls.Add(tempRow)
                        Next tbRow
                        bln = True
                    End If
                End If
                ds.Dispose()
                ds = Nothing
                da.Disconnect()
                da.Dispose()
                da = Nothing
                Return bln
     
            End Function

Discussions similaires

  1. Ajout de lignes dans un tablea HTML : enregistrement dans une table Mysql
    Par jean-pierre96 dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 23/04/2007, 18h44
  2. Ajout de lignes dans table fichier
    Par Philippe.p dans le forum WinDev
    Réponses: 8
    Dernier message: 08/12/2006, 16h58
  3. Réponses: 14
    Dernier message: 22/09/2005, 16h49

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