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 :

Impossible de trouver le contrôle dans ControlParameter


Sujet :

ASP.NET

  1. #1
    Membre éclairé
    Homme Profil pro
    consultant java
    Inscrit en
    Août 2010
    Messages
    325
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : consultant java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2010
    Messages : 325
    Par défaut Impossible de trouver le contrôle dans ControlParameter
    bonjour,
    j'ai un souci avec "updatecommand"

    elle met ajour tout les ligne de la table
    et quand j'ai essaye d'ajout un where ca me donne cette erreur :
    Impossible de trouver le contrôle 'id_etablissementLabel' dans ControlParameter 'id_etablissement'
    voici 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
     
        <asp:FormView ID="FormView1" runat="server" AllowPaging="True" 
            DataSourceID="SqlDataSource1">
            <EditItemTemplate>
                id_etablissement:
                <asp:Label ID="id_etablissementLabel1" runat="server" 
                    Text='<%# Eval("id_etablissement") %>' />
                <br />
                VIlle:
                <asp:TextBox ID="VIlleTextBox" runat="server" Text='<%# Bind("VIlle") %>' />
                <br />
                Secteur:
                <asp:TextBox ID="SecteurTextBox" runat="server" Text='<%# Bind("Secteur") %>' />
                <br />
                Etablissement:
                <asp:TextBox ID="EtablissementTextBox" runat="server" 
                    Text='<%# Bind("Etablissement") %>' />
                <br />
                FiliereDeFormation:
                <asp:TextBox ID="FiliereDeFormationTextBox" runat="server" 
                    Text='<%# Bind("FiliereDeFormation") %>' />
                <br />
                Niveau:
                <asp:TextBox ID="NiveauTextBox" runat="server" Text='<%# Bind("Niveau") %>' />
                <br />
                fiche:
                <asp:TextBox ID="ficheTextBox" runat="server" Text='<%# Bind("fiche") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Mettre à jour" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Annuler" />
            </EditItemTemplate>
            <InsertItemTemplate>
                VIlle:
                <asp:TextBox ID="VIlleTextBox" runat="server" Text='<%# Bind("VIlle") %>' />
                <br />
                Secteur:
                <asp:TextBox ID="SecteurTextBox" runat="server" Text='<%# Bind("Secteur") %>' />
                <br />
                Etablissement:
                <asp:TextBox ID="EtablissementTextBox" runat="server" 
                    Text='<%# Bind("Etablissement") %>' />
                <br />
                FiliereDeFormation:
                <asp:TextBox ID="FiliereDeFormationTextBox" runat="server" 
                    Text='<%# Bind("FiliereDeFormation") %>' />
                <br />
                Niveau:
                <asp:TextBox ID="NiveauTextBox" runat="server" Text='<%# Bind("Niveau") %>' />
                <br />
                fiche:
                <asp:TextBox ID="ficheTextBox" runat="server" Text='<%# Bind("fiche") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insérer" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Annuler" />
            </InsertItemTemplate>
            <ItemTemplate>
                id_etablissement:
                <asp:Label ID="id_etablissementLabel" runat="server" 
                    Text='<%# Eval("id_etablissement") %>' />
                <br />
                VIlle:
                <asp:Label ID="VIlleLabel" runat="server" Text='<%# Bind("VIlle") %>' />
                <br />
                Secteur:
                <asp:Label ID="SecteurLabel" runat="server" 
                    Text='<%# Bind("Secteur") %>' />
                <br />
                Etablissement:
                <asp:Label ID="EtablissementLabel" runat="server" 
                    Text='<%# Bind("Etablissement") %>' />
                <br />
                FiliereDeFormation:
                <asp:Label ID="FiliereDeFormationLabel" runat="server" 
                    Text='<%# Bind("FiliereDeFormation") %>' />
                <br />
                Niveau:
                <asp:Label ID="NiveauLabel" runat="server" Text='<%# Bind("Niveau") %>' />
                <br />
     
                fiche:
                <asp:Label ID="ficheLabel" runat="server" Text='<%# Bind("fiche") %>' />
                <br />
     
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Modifier" />
            </ItemTemplate>
        </asp:FormView>
     
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:offptConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:offptConnectionString.ProviderName %>" 
            SelectCommand="SELECT id_etablissement,VIlle, Secteur, Etablissement, FiliereDeFormation, Niveau, fiche FROM etablissement" 
     
            UpdateCommand="UPDATE etablissement SET VIlle = @ville, Secteur = @secteur, Etablissement = @Etablissement, FiliereDeFormation = @FiliereDeFormation, Niveau = @niveau, fiche = @fiche, WHERE (id_etablissement = @id_etablissement)">
            <SelectParameters>
            <asp:ControlParameter   Name="id_etablissement" ControlID="id_etablissementLabel1" />
            </SelectParameters>
            <UpdateParameters>
     
            <asp:Parameter Name="id_etablissement"   Type="Int32"/>
     
            </UpdateParameters>
     
        </asp:SqlDataSource>

  2. #2
    Membre émérite Avatar de Ramajb
    Homme Profil pro
    ----------------------------
    Inscrit en
    Septembre 2007
    Messages
    476
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : ----------------------------

    Informations forums :
    Inscription : Septembre 2007
    Messages : 476
    Par défaut
    Bonjour,
    C'est parce que tu essaie d’accéder a un control qui se trouve dans un conteneur, ici FormView.
    Donc si tu voulais accéder a la valeur du Label avec ID="id_etablissementLabel1" qui se trouve a l’intérieur du control FormView, tu definira le control parameter comme ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <asp:ControlParameter   Name="id_etablissement" ControlID="FormView1$id_etablissementLabel1" />
    J’espère t'avoir aidé.

  3. #3
    Membre éclairé
    Homme Profil pro
    consultant java
    Inscrit en
    Août 2010
    Messages
    325
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : consultant java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2010
    Messages : 325
    Par défaut
    bonjour,
    j'ai toujours la meme erreur :

    Impossible de trouver le contrôle 'FormView1$id_etablissementLabel1' dans ControlParameter 'id_etablissement'.

    voici le 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
     
     
      <asp:FormView ID="FormView1" runat="server" AllowPaging="True" 
            DataSourceID="SqlDataSource1">
            <EditItemTemplate>
                id_etablissement:
                <asp:Label ID="id_etablissementLabel1" runat="server" 
                    Text='<%# Eval("id_etablissement") %>' />
                <br />
                VIlle:
                <asp:TextBox ID="VIlleTextBox" runat="server" Text='<%# Bind("VIlle") %>' />
                <br />
                Secteur:
                <asp:TextBox ID="SecteurTextBox" runat="server" Text='<%# Bind("Secteur") %>' />
                <br />
                Etablissement:
                <asp:TextBox ID="EtablissementTextBox" runat="server" 
                    Text='<%# Bind("Etablissement") %>' />
                <br />
                FiliereDeFormation:
                <asp:TextBox ID="FiliereDeFormationTextBox" runat="server" 
                    Text='<%# Bind("FiliereDeFormation") %>' />
                <br />
                Niveau:
                <asp:TextBox ID="NiveauTextBox" runat="server" Text='<%# Bind("Niveau") %>' />
                <br />
                fiche:
                <asp:TextBox ID="ficheTextBox" runat="server" Text='<%# Bind("fiche") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Mettre à jour" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Annuler" />
            </EditItemTemplate>
            <InsertItemTemplate>
                VIlle:
                <asp:TextBox ID="VIlleTextBox" runat="server" Text='<%# Bind("VIlle") %>' />
                <br />
                Secteur:
                <asp:TextBox ID="SecteurTextBox" runat="server" Text='<%# Bind("Secteur") %>' />
                <br />
                Etablissement:
                <asp:TextBox ID="EtablissementTextBox" runat="server" 
                    Text='<%# Bind("Etablissement") %>' />
                <br />
                FiliereDeFormation:
                <asp:TextBox ID="FiliereDeFormationTextBox" runat="server" 
                    Text='<%# Bind("FiliereDeFormation") %>' />
                <br />
                Niveau:
                <asp:TextBox ID="NiveauTextBox" runat="server" Text='<%# Bind("Niveau") %>' />
                <br />
                fiche:
                <asp:TextBox ID="ficheTextBox" runat="server" Text='<%# Bind("fiche") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insérer" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Annuler" />
            </InsertItemTemplate>
            <ItemTemplate>
                id_etablissement:
                <asp:Label ID="id_etablissementLabel" runat="server" 
                    Text='<%# Eval("id_etablissement") %>' />
                <br />
                VIlle:
                <asp:Label ID="VIlleLabel" runat="server" Text='<%# Bind("VIlle") %>' />
                <br />
                Secteur:
                <asp:Label ID="SecteurLabel" runat="server" 
                    Text='<%# Bind("Secteur") %>' />
                <br />
                Etablissement:
                <asp:Label ID="EtablissementLabel" runat="server" 
                    Text='<%# Bind("Etablissement") %>' />
                <br />
                FiliereDeFormation:
                <asp:Label ID="FiliereDeFormationLabel" runat="server" 
                    Text='<%# Bind("FiliereDeFormation") %>' />
                <br />
                Niveau:
                <asp:Label ID="NiveauLabel" runat="server" Text='<%# Bind("Niveau") %>' />
                <br />
     
                fiche:
                <asp:Label ID="ficheLabel" runat="server" Text='<%# Bind("fiche") %>' />
                <br />
     
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Modifier" />
            </ItemTemplate>
        </asp:FormView>
     
     
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:offptConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:offptConnectionString.ProviderName %>" 
            SelectCommand="SELECT id_etablissement,VIlle, Secteur, Etablissement, FiliereDeFormation, Niveau, fiche FROM etablissement" 
     
            UpdateCommand="UPDATE etablissement SET VIlle = @ville, Secteur = @secteur, 
            Etablissement = @Etablissement, FiliereDeFormation = @FiliereDeFormation, Niveau = @niveau, fiche = @fiche,
             WHERE (id_etablissement = @id_etablissement)">
            <SelectParameters>
     
            <asp:ControlParameter   Name="id_etablissement" ControlID="FormView1$id_etablissementLabel1" /> 
            </SelectParameters>
            <UpdateParameters>
     
            <asp:Parameter Name="id_etablissement"   Type="Int32"/>
     
            </UpdateParameters>
     
        </asp:SqlDataSource>

  4. #4
    Membre éclairé
    Homme Profil pro
    consultant java
    Inscrit en
    Août 2010
    Messages
    325
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : consultant java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2010
    Messages : 325
    Par défaut
    je vien de mettre ça :

    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
     
       <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:offptConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:offptConnectionString.ProviderName %>" 
            SelectCommand="SELECT id_etablissement,VIlle, Secteur, Etablissement, FiliereDeFormation, Niveau, fiche FROM etablissement" 
     
            UpdateCommand="UPDATE etablissement SET VIlle = @ville, Secteur = @secteur, 
            Etablissement = @Etablissement, FiliereDeFormation = @FiliereDeFormation, Niveau = @niveau, fiche = @fiche,
             WHERE (id_etablissement = @id_etablissement)">
            <SelectParameters>
     
     
            </SelectParameters>
            <UpdateParameters>
            <asp:ControlParameter   Name="id_etablissement"  ControlID="FormView1.EditItemTemplate.EditItemTemplate.id_etablissementLabel1" Type="Int32"/> 
     
     
            </UpdateParameters>
    mais le message d'erreur que j'ai actuelement c'est celui là :
    ,quand je clique sur modifier j'ai le formulaire je modifie , quand je clique sur mettre a joure j'ai ça :
    Erreur de syntaxe prés de 'WHERE id_etablissement = NULL' à la ligne 2

  5. #5
    Membre émérite Avatar de Ramajb
    Homme Profil pro
    ----------------------------
    Inscrit en
    Septembre 2007
    Messages
    476
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : ----------------------------

    Informations forums :
    Inscription : Septembre 2007
    Messages : 476
    Par défaut
    Je viens de m'apercevoir que tu essaies de récupérer la valeur du Label qui n'est pas encore bindé au moment que tu l'utilises. Donc tu n'aura jamais la valeur du textBox.

  6. #6
    Membre éclairé
    Homme Profil pro
    consultant java
    Inscrit en
    Août 2010
    Messages
    325
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : consultant java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2010
    Messages : 325
    Par défaut
    bonjour,
    merci j'ai reglé le souci . aufait y avais une virgule qui tourné dans la requet et c'est elle qui a cree ce souci





    merci

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

Discussions similaires

  1. Comment trouver les contrôles dans un DBCtrlGrid
    Par Bruno75 dans le forum Composants VCL
    Réponses: 7
    Dernier message: 19/12/2010, 17h42
  2. Réponses: 11
    Dernier message: 12/03/2010, 22h30
  3. Réponses: 4
    Dernier message: 15/12/2008, 10h02
  4. impossible de trouver l'erreur dans cette requete
    Par laurent.w dans le forum Langage SQL
    Réponses: 2
    Dernier message: 06/01/2007, 10h38
  5. Réponses: 13
    Dernier message: 25/01/2006, 12h02

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