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 :

Probleme avec les DropDownList imbriqués


Sujet :

ASP.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Juin 2009
    Messages
    187
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 187
    Par défaut Probleme avec les DropDownList imbriqués
    Bonjour,

    J'essaye d'imbriquer deux DropDownList dans mon un formView, je reccupere les donnees sur les deux DorpDownList. mais quand je cique sur inserer une erreur s'affiche voila la code JSP.
    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
     
    <asp:Content ID="Content1" ContentPlaceHolderID="nouveau_dossier" runat="server">
     
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:basedossierConnectionString %>" 
            SelectCommand="SELECT [num_dossier], [num_envoi_commune], [num_arrivee_agence], [date_arrivee_agence], [observation], [petitionaire], [date_envoi_commun], [num_envoi_agence], [date_envoi_agance], [id_commune], [code_projet], [reference_fonciere] FROM [dossier]">
        </asp:SqlDataSource>
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="num_dossier" 
            DataSourceID="SqlDataSource1" DefaultMode="Insert">
            <EditItemTemplate>
                num_dossier:
                <asp:Label ID="num_dossierLabel1" runat="server" 
                    Text='<%# Eval("num_dossier") %>' />
                <br />
                num_envoi_commune:
                <asp:TextBox ID="num_envoi_communeTextBox" runat="server" 
                    Text='<%# Bind("num_envoi_commune") %>' />
                <br />
                num_arrivee_agence:
                <asp:TextBox ID="num_arrivee_agenceTextBox" runat="server" 
                    Text='<%# Bind("num_arrivee_agence") %>' />
                <br />
                date_arrivee_agence:
                <asp:TextBox ID="date_arrivee_agenceTextBox" runat="server" 
                    Text='<%# Bind("date_arrivee_agence") %>' />
                <br />
                observation:
                <asp:TextBox ID="observationTextBox" runat="server" 
                    Text='<%# Bind("observation") %>' />
                <br />
                petitionaire:
                <asp:TextBox ID="petitionaireTextBox" runat="server" 
                    Text='<%# Bind("petitionaire") %>' />
                <br />
                date_envoi_commun:
                <asp:TextBox ID="date_envoi_communTextBox" runat="server" 
                    Text='<%# Bind("date_envoi_commun") %>' />
                <br />
                num_envoi_agence:
                <asp:TextBox ID="num_envoi_agenceTextBox" runat="server" 
                    Text='<%# Bind("num_envoi_agence") %>' />
                <br />
                date_envoi_agance:
                <asp:TextBox ID="date_envoi_aganceTextBox" runat="server" 
                    Text='<%# Bind("date_envoi_agance") %>' />
                <br />
                id_commune:
                <asp:TextBox ID="id_communeTextBox" runat="server" 
                    Text='<%# Bind("id_commune") %>' />
                <br />
                code_projet:
                <asp:TextBox ID="code_projetTextBox" runat="server" 
                    Text='<%# Bind("code_projet") %>' />
                <br />
                reference_fonciere:
                <asp:TextBox ID="reference_fonciereTextBox" runat="server" 
                    Text='<%# Bind("reference_fonciere") %>' />
                <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>
                num_dossier:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="num_dossierTextBox" runat="server" 
                    Text='<%# Bind("num_dossier") %>' />
                <br />
                num_envoi_commune:
                <asp:TextBox ID="num_envoi_communeTextBox" runat="server" 
                    Text='<%# Bind("num_envoi_commune") %>' />
                <br />
                num_arrivee_agence:&nbsp;&nbsp;
                <asp:TextBox ID="num_arrivee_agenceTextBox" runat="server" 
                    Text='<%# Bind("num_arrivee_agence") %>' />
                <br />
                date_arrivee_agence:&nbsp;
                <asp:TextBox ID="date_arrivee_agenceTextBox" runat="server" 
                    Text='<%# Bind("date_arrivee_agence") %>' />
                <br />
                observation:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="observationTextBox" runat="server" 
                    Text='<%# Bind("observation") %>' />
                <br />
                petitionaire:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="petitionaireTextBox" runat="server" 
                    Text='<%# Bind("petitionaire") %>' />
                <br />
                date_envoi_commun:&nbsp;
                <asp:TextBox ID="date_envoi_communTextBox" runat="server" 
                    Text='<%# Bind("date_envoi_commun") %>' />
                <br />
                num_envoi_agence:&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="num_envoi_agenceTextBox" runat="server" 
                    Text='<%# Bind("num_envoi_agence") %>' />
                <br />
                date_envoi_agance:&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="date_envoi_aganceTextBox" runat="server" 
                    Text='<%# Bind("date_envoi_agance") %>' />
                <br />
                id_commune:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:DropDownList ID="DropDownList1" runat="server" 
                    DataSourceID="SqlDataSource3" DataTextField="id_commune" 
                    DataValueField="id_commune" SelectedValue='<%# Bind("id_commune") %>'>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:basedossierConnectionString %>" 
                    SelectCommand="SELECT [id_commune] FROM [commune]"></asp:SqlDataSource>
                <br />
                code_projet:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:DropDownList ID="DropDownList2" runat="server" 
                    DataSourceID="SqlDataSource2" DataTextField="code_projet" 
                    DataValueField="code_projet" SelectedValue='<%# Bind("code_projet") %>'>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:basedossierConnectionString %>" 
                    SelectCommand="SELECT [code_projet] FROM [projet]"></asp:SqlDataSource>
                <br />
                reference_fonciere:
                <asp:TextBox ID="reference_fonciereTextBox" runat="server" 
                    Text='<%# Bind("reference_fonciere") %>' />
                <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>
                Numero de dossier:
                <asp:Label ID="num_dossierLabel" runat="server" 
                    Text='<%# Eval("num_dossier") %>' />
                <br />
                Numero d'envoi par la commune:
                <asp:Label ID="num_envoi_communeLabel" runat="server" 
                    Text='<%# Bind("num_envoi_commune") %>' />
                <br />
                Numero d'arrivee a l'agence:
                <asp:Label ID="num_arrivee_agenceLabel" runat="server" 
                    Text='<%# Bind("num_arrivee_agence") %>' />
                <br />
                Date d'arrivee a l'agence:
                <asp:Label ID="date_arrivee_agenceLabel" runat="server" 
                    Text='<%# Bind("date_arrivee_agence") %>' />
                <br />
                Observation:
                <asp:Label ID="observationLabel" runat="server" 
                    Text='<%# Bind("observation") %>' />
                <br />
                Petitionaire:
                <asp:Label ID="petitionaireLabel" runat="server" 
                    Text='<%# Bind("petitionaire") %>' />
                <br />
                Date d'envoi au commune:
                <asp:Label ID="date_envoi_communLabel" runat="server" 
                    Text='<%# Bind("date_envoi_commun") %>' />
                <br />
                Numero d'envoi par l' agence:
                <asp:Label ID="num_envoi_agenceLabel" runat="server" 
                    Text='<%# Bind("num_envoi_agence") %>' />
                <br />
                Date d'envoi par l'agance:
                <asp:Label ID="date_envoi_aganceLabel" runat="server" 
                    Text='<%# Bind("date_envoi_agance") %>' />
                <br />
                Commune:
                <asp:Label ID="id_communeLabel" runat="server" 
                    Text='<%# Bind("id_commune") %>' />
                <br />
                Projet:
                <asp:Label ID="code_projetLabel" runat="server" 
                    Text='<%# Bind("code_projet") %>' />
                <br />
                Reference fonciere:
                <asp:Label ID="reference_fonciereLabel" runat="server" 
                    Text='<%# Bind("reference_fonciere") %>' />
                <br />
            </ItemTemplate>
        </asp:FormView>   
        </asp:Content>
    l'erreur qui s'affiche pendant l'exécution est :
    Erreur du serveur dans l'application '/'.
    L'insertion n'est pas prise en charge par la source de données 'SqlDataSource1' sauf si InsertCommand est spécifié.
    Description : Une exception non gérée s'est produite au moment de l'exécution de la demande Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code.

    Détails de l'exception: System.NotSupportedException: L'insertion n'est pas prise en charge par la source de données 'SqlDataSource1' sauf si InsertCommand est spécifié.

    Erreur source:

    Une exception non gérée s'est produite lors de l'exécution de la demande Web actuelle. Les informations relatives à l'origine et l'emplacement de l'exception peuvent être identifiées en utilisant la trace de la pile d'exception ci-dessous.

    Trace de la pile:

    [NotSupportedException: L'insertion n'est pas prise en charge par la source de données 'SqlDataSource1' sauf si InsertCommand est spécifié.]
    System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +1645168
    System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +86
    System.Web.UI.WebControls.FormView.HandleInsert(String commandArg, Boolean causesValidation) +272
    System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +676
    System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e) +95
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
    System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e) +113
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
    System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
    System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
    System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
    pouvez vous m'aider merci .

  2. #2
    Membre confirmé
    Homme Profil pro
    Apprenti en dévelloppement
    Inscrit en
    Août 2010
    Messages
    81
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France

    Informations professionnelles :
    Activité : Apprenti en dévelloppement

    Informations forums :
    Inscription : Août 2010
    Messages : 81
    Par défaut
    Quel est ton code behind?

  3. #3
    Membre expérimenté
    Homme Profil pro
    Inscrit en
    Septembre 2009
    Messages
    220
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 220
    Par défaut
    C'est normal, tu n'a pas défini l'action Insert dans ta DataSource. En effet, tu dois définir un InsertCommand de la même façon que tu as un SelectCommand.

    Jettes un oeil ici si tu as du mal:
    http://msdn.microsoft.com/fr-fr/libr...(v=vs.80).aspx

  4. #4
    Membre confirmé
    Inscrit en
    Juin 2009
    Messages
    187
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 187
    Par défaut
    Je vous remercie infiniment

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

Discussions similaires

  1. Help!! Probleme avec les dates sur SQL SERVER
    Par Nadaa dans le forum MS SQL Server
    Réponses: 16
    Dernier message: 03/08/2006, 16h55
  2. PROBLEME AVEC LES REQUETES IS NULL / NOT EXISTS
    Par sylvaine dans le forum Langage SQL
    Réponses: 5
    Dernier message: 04/06/2004, 13h26
  3. [langage] probleme avec les listes dans des listes
    Par pqmoltonel dans le forum Langage
    Réponses: 7
    Dernier message: 27/04/2004, 12h32
  4. Problem avec les *.AVI sur les panels
    Par NaDiA_SoFt dans le forum C++Builder
    Réponses: 3
    Dernier message: 31/08/2003, 22h50
  5. probleme avec les processus
    Par saidi dans le forum Autres éditeurs
    Réponses: 1
    Dernier message: 05/02/2003, 00h18

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