bjr,
j'ai deux formulaire, un affichage d'appel et l'autre insertion de nouvel appel.
lorsque j'inserer un nouvel appel j'aimerai le voir afficher par la suite dans mon formulaire appel. comment faire.
merci
Version imprimable
bjr,
j'ai deux formulaire, un affichage d'appel et l'autre insertion de nouvel appel.
lorsque j'inserer un nouvel appel j'aimerai le voir afficher par la suite dans mon formulaire appel. comment faire.
merci
T'es en quel version du framework ?
Les formulaires en question sont de quels types (GridView ? , FormView ? ) ?
l'affichage des appels c dans une gridview et l'insertion dans une formview
Citation:
Envoyé par mehdi_tn
Normalement après l'événement inserted tu fais un simple databind sur ton GridView. Elle a un truc en particulier la nouvelle ligne insérée dans le GridView?
je ne vois pas bien. peux tu expliquer un peu.
j'ecris où?
Citation:
Envoyé par mehdi_tn
Dans l'événement ItemInserted de ton FormView. Fais :Citation:
Envoyé par hermine
Code:GridView1.DataBind()
ma gridview et mon formview ne sont pas sur la même page.
Citation:
Envoyé par mehdi_tn
j'ai une erreur,
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 Erreur du serveur dans l'application '/VueSTC'. -------------------------------------------------------------------------------- Erreur de compilation Description : Une erreur s'est produite lors de la compilation d'une ressource requise pour répondre à cette demande. Veuillez consulter ci-dessous les détails relatifs à l'erreur en question, puis modifier votre code source de manière appropriée. Message d'erreur du compilateur: CS0103: Le nom 'GridView1' n'existe pas dans le contexte actuel Erreur source: Ligne 23 : protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) Ligne 24 : { Ligne 25 : GridView1.DataBind(); Ligne 26 : } Ligne 27 : } Fichier source: c:\dev\APPLIWeb\VueSTC\Appels\NouvelAppel.aspx.cs Ligne: 25
Citation:
Envoyé par hermine
Ooops tu as raison. Mais j'ai besoin de plus de précisionCitation:
Envoyé par hermine
Donc Page1.aspx contient le FormView
Page2.aspx contient le GridView.
Tu insére un enregistrement dans le FormView et tu veux qu'il soit affiché dans le GridView ?
Ca doit se faire automatiquement normalement. Elle est où l'anomalie ?
ça ne s'affiche pas!!!
Citation:
Envoyé par mehdi_tn
Hermine, il faut faire un peu d'efforts si tu veux de l'aide.
Un peu de code .... Un peu plus de détails.
Quand tu réponds ca ne s'affiche pas, ça m'aide pas vraiment.
ce que je voulais dire est que l'insertion s'effectue bien mais lorsque je vais sur ma page qui contient ma gridview,l'enregistrement effectuée n'y est pas. alors que sur le requeteur et dans ma table elle y est.
Citation:
Envoyé par mehdi_tn
Montre nous ton code apsx et cs de ta page qui affiche le grid view
bjr,
je n'arrive pas tjrs à rafraichir ma gridview.
voici le code de mon gridview
Code:
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 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2" DataKeyNames="A_NUMEROAPPEL" DataSourceID="ObjectDataSource2" ForeColor="#333333" Style="z-index: 100; left: 200px; position: absolute; top: 232px; border-top-style: solid; border-right-style: solid; border-left-style: solid; border-bottom-style: solid;" OnSelectedIndexChanged="Page_Load" CellSpacing="2"> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <Columns> <asp:BoundField DataField="A_ETAT" HeaderText="Etat" SortExpression="A_ETAT" /> <asp:BoundField DataField="A_NUMEROAPPEL" HeaderText="Numero appel" ReadOnly="True" SortExpression="A_NUMEROAPPEL" /> <asp:BoundField DataField="A_SOCIETECODE" HeaderText="Code societé" SortExpression="A_SOCIETECODE" Visible="False" /> <asp:BoundField DataField="A_SOCIETELIB" HeaderText="Societé" SortExpression="A_SOCIETELIB" /> <asp:BoundField DataField="A_URGENCE" HeaderText="Urgence" SortExpression="A_URGENCE" /> <asp:BoundField DataField="A_PRIORITE" HeaderText="Priorité" SortExpression="A_PRIORITE" /> <asp:BoundField DataField="A_IMPACT" HeaderText="Impact" SortExpression="A_IMPACT" /> <asp:BoundField DataField="A_CREATEUR" HeaderText="Créateur" SortExpression="A_CREATEUR" /> <asp:BoundField DataField="A_DATECREATION" HeaderText="Date création" SortExpression="A_DATECREATION" /> <asp:BoundField DataField="A_VECTEURAPPEL" HeaderText="Provenance" SortExpression="A_VECTEURAPPEL" /> <asp:BoundField DataField="A_PRODUITCODE" HeaderText="Code produit" SortExpression="A_PRODUITCODE" /> <asp:BoundField DataField="A_PRODUITLIB" HeaderText="Produit" SortExpression="A_PRODUITLIB" /> <asp:BoundField DataField="LIB_VERSION" HeaderText="Version" SortExpression="LIB_VERSION" Visible="False" /> <asp:BoundField DataField="A_VERSION" HeaderText="Version" SortExpression="A_VERSION" /> <asp:BoundField DataField="A_EVALUATION" HeaderText="Evaluation" SortExpression="A_EVALUATION" /> <asp:BoundField DataField="AFF_AFFAIRE2" HeaderText="Contrat" SortExpression="AFF_AFFAIRE2" Visible="False" /> <asp:BoundField DataField="A_CONTRATCODE" HeaderText="Contrat" SortExpression="A_CONTRATCODE" /> <asp:BoundField DataField="A_PARTENAIRE" HeaderText="Partenaire" SortExpression="A_PARTENAIRE" /> <asp:BoundField DataField="A_INTERLCODE" HeaderText="A_INTERLCODE" SortExpression="A_INTERLCODE" Visible="False" /> <asp:BoundField DataField="A_INTERLLIB" HeaderText="Interlocuteur" SortExpression="A_INTERLLIB" /> <asp:BoundField DataField="A_INTERLTEL" HeaderText="Tel" SortExpression="A_INTERLTEL" /> <asp:BoundField DataField="A_INTERLMAIL" HeaderText="Mail" SortExpression="A_INTERLMAIL" /> <asp:BoundField DataField="A_DESCRIPTION" HeaderText="Description" SortExpression="A_DESCRIPTION" /> <asp:BoundField DataField="LIB_PRODUIT" HeaderText="LIB_PRODUIT" SortExpression="LIB_PRODUIT" Visible="False" /> <asp:HyperLinkField DataNavigateUrlFields="A_NUMEROAPPEL" DataNavigateUrlFormatString="DetailsAPPEL.aspx?ID={0}" HeaderText="Détails" Text="Détails" /> </Columns> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" /> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> <%--connection à la source de donnée et appel de la methode get du dataset--%> <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetAPPELS" TypeName="DataAccess.DsAPPELSTableAdapters.SP_GET_APPELSTableAdapter"> </asp:ObjectDataSource> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SocieteConnectionString %>" SelectCommand="SELECT APPELS.A_ETAT, APPELS.A_NUMEROAPPEL, APPELS.A_SOCIETECODE, APPELS.A_SOCIETELIB, APPELS.A_URGENCE, APPELS.A_PRIORITE, APPELS.A_IMPACT, APPELS.A_CREATEUR, APPELS.A_DATECREATION, APPELS.A_VECTEURAPPEL, APPELS.A_MODIFIEPAR, APPELS.A_DATEMODIF, APPELS.A_PRODUITCODE, APPELS.A_PRODUITLIB, APPELS.A_VERSION, APPELS.A_EVALUATION, APPELS.A_CONTRATCODE, APPELS.A_PARTENAIRE, APPELS.A_INTERLCODE, APPELS.A_INTERLLIB, APPELS.A_INTERLTEL, APPELS.A_INTERLMAIL, APPELS.A_DESCRIPTION, V_PRODUIT_VERSION.LIB_PRODUIT, V_PRODUIT_VERSION.LIB_VERSION, CONTRATS_VALIDES.AFF_AFFAIRE2 FROM APPELS CROSS JOIN V_PRODUIT_VERSION CROSS JOIN CONTRATS_VALIDES WHERE (APPELS.A_ETAT = 'Non Lu')"> </asp:SqlDataSource> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="DataSet2TableAdapters.APPELSTableAdapter"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" DefaultValue="Non Lu" Name="A_ETAT" PropertyName="SelectedValue" Type="String" /> </SelectParameters> <%--insertion des parametres --%> <InsertParameters> <asp:Parameter Name="A_NUMEROAPPEL" Type="Decimal" /> <asp:Parameter Name="A_ETAT" Type="String" /> <asp:Parameter Name="A_URGENCE" Type="String" /> <asp:Parameter Name="A_IMPACT" Type="String" /> <asp:Parameter Name="A_PRIORITE" Type="String" /> <asp:Parameter Name="A_CREATEUR" Type="String" /> <asp:Parameter Name="A_DATECREATION" Type="DateTime" /> <asp:Parameter Name="A_VECTEURAPPEL" Type="String" /> <asp:Parameter Name="A_MODIFIEPAR" Type="String" /> <asp:Parameter Name="A_DATEMODIF" Type="DateTime" /> <asp:Parameter Name="A_PRODUITCODE" Type="String" /> <asp:Parameter Name="A_PRODUITLIB" Type="String" /> <asp:Parameter Name="A_VERSION" Type="String" /> <asp:Parameter Name="A_EVALUATION" Type="String" /> <asp:Parameter Name="A_CONTRATCODE" Type="String" /> <asp:Parameter Name="A_SOCIETECODE" Type="String" /> <asp:Parameter Name="A_SOCIETELIB" Type="String" /> <asp:Parameter Name="A_PARTENAIRE" Type="String" /> <asp:Parameter Name="A_INTERLCODE" Type="String" /> <asp:Parameter Name="A_INTERLLIB" Type="String" /> <asp:Parameter Name="A_INTERLTEL" Type="String" /> <asp:Parameter Name="A_INTERLMAIL" Type="String" /> <asp:Parameter Name="A_DESCRIPTION" Type="String" /> </InsertParameters> </asp:ObjectDataSource> <br /> <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Larger" ForeColor="#C04000" Style="z-index: 102; left: 316px; position: absolute; top: 212px" Text="LISTE DES APPELS EN COURS DE TRAITEMENT" Width="788px"></asp:Label> </asp:Content>
voici le code de ma fromview
formview.csCode:
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298 <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="NouvelAppel.aspx.cs" Inherits="Appels_NouvelAppel1" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server"> <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataSourceID="SqlDataSource1" DefaultMode="Insert" Style="z-index: 16; left: 184px; position: absolute; top: 160px" DataKeyNames="A_NUMEROAPPEL" CellPadding="4" ForeColor="#333333" > <EditItemTemplate> A_NUMEROAPPEL: <asp:Label ID="A_NUMEROAPPELLabel1" runat="server" Text='<%# Eval("A_NUMEROAPPEL") %>'> </asp:Label><br /> A_ETAT: <asp:TextBox ID="A_ETATTextBox" runat="server" Text='<%# Bind("A_ETAT") %>'> </asp:TextBox><br /> A_URGENCE: <asp:TextBox ID="A_URGENCETextBox" runat="server" Text='<%# Bind("A_URGENCE") %>'> </asp:TextBox><br /> A_IMPACT: <asp:TextBox ID="A_IMPACTTextBox" runat="server" Text='<%# Bind("A_IMPACT") %>'> </asp:TextBox><br /> A_PRIORITE: <asp:TextBox ID="A_PRIORITETextBox" runat="server" Text='<%# Bind("A_PRIORITE") %>'> </asp:TextBox><br /> A_CREATEUR: <asp:TextBox ID="A_CREATEURTextBox" runat="server" Text='<%# Bind("A_CREATEUR") %>'> </asp:TextBox><br /> A_DATECREATION: <asp:TextBox ID="A_DATECREATIONTextBox" runat="server" Text='<%# Bind("A_DATECREATION") %>'> </asp:TextBox><br /> A_VECTEURAPPEL: <asp:TextBox ID="A_VECTEURAPPELTextBox" runat="server" Text='<%# Bind("A_VECTEURAPPEL") %>'> </asp:TextBox><br /> A_PRODUITCODE: <asp:TextBox ID="A_PRODUITCODETextBox" runat="server" Text='<%# Bind("A_PRODUITCODE") %>'> </asp:TextBox><br /> A_PRODUITLIB: <asp:TextBox ID="A_PRODUITLIBTextBox" runat="server" Text='<%# Bind("A_PRODUITLIB") %>'> </asp:TextBox><br /> A_VERSION: <asp:TextBox ID="A_VERSIONTextBox" runat="server" Text='<%# Bind("A_VERSION") %>'> </asp:TextBox><br /> A_EVALUATION: <asp:TextBox ID="A_EVALUATIONTextBox" runat="server" Text='<%# Bind("A_EVALUATION") %>'> </asp:TextBox><br /> A_CONTRATCODE: <asp:TextBox ID="A_CONTRATCODETextBox" runat="server" Text='<%# Bind("A_CONTRATCODE") %>'> </asp:TextBox><br /> A_SOCIETECODE: <asp:TextBox ID="A_SOCIETECODETextBox" runat="server" Text='<%# Bind("A_SOCIETECODE") %>'> </asp:TextBox><br /> A_SOCIETELIB: <asp:TextBox ID="A_SOCIETELIBTextBox" runat="server" Text='<%# Bind("A_SOCIETELIB") %>'> </asp:TextBox><br /> A_PARTENAIRE: <asp:TextBox ID="A_PARTENAIRETextBox" runat="server" Text='<%# Bind("A_PARTENAIRE") %>'> </asp:TextBox><br /> A_INTERLCODE: <asp:TextBox ID="A_INTERLCODETextBox" runat="server" Text='<%# Bind("A_INTERLCODE") %>'> </asp:TextBox><br /> A_INTERLLIB: <asp:TextBox ID="A_INTERLLIBTextBox" runat="server" Text='<%# Bind("A_INTERLLIB") %>'> </asp:TextBox><br /> A_INTERLTEL: <asp:TextBox ID="A_INTERLTELTextBox" runat="server" Text='<%# Bind("A_INTERLTEL") %>'> </asp:TextBox><br /> A_INTERLMAIL: <asp:TextBox ID="A_INTERLMAILTextBox" runat="server" Text='<%# Bind("A_INTERLMAIL") %>'> </asp:TextBox><br /> A_DESCRIPTION: <asp:TextBox ID="A_DESCRIPTIONTextBox" runat="server" Text='<%# Bind("A_DESCRIPTION") %>'> </asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Mettre à jour"> </asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Annuler"> </asp:LinkButton> </EditItemTemplate> <InsertItemTemplate> <asp:Panel ID="Panel1" runat="server" GroupingText="Societé" Height="1px" Style="position: static;" Width="688px"> Code societé:<asp:TextBox ID="A_SOCIETECODETextBox" runat="server" Text='<%# Bind("A_SOCIETECODE") %>' style="position: static"></asp:TextBox> <asp:Button ID="Button1" runat="server" Style="position: static" Text="Rechercher" Width="96px" /><br /> <br /> Contrat: <asp:TextBox ID="A_CONTRATCODETextBox" runat="server" Text='<%# Bind("A_CONTRATCODE") %>' style="position: static" Width="80px"></asp:TextBox> Libellé societé: <asp:TextBox ID="A_SOCIETELIBTextBox" runat="server" Text='<%# Bind("A_SOCIETELIB") %>' style="position: static" Width="152px"></asp:TextBox> Origine:<asp:DropDownList ID="UrgenceDropDownList" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="SqlDataSource4" DataTextField="A_URGENCE" DataValueField="A_NUMEROAPPEL" OnSelectedIndexChanged="Page_Load" SelectedValue='<%# Bind("A_URGENCE") %>' Style="position: static" Width="88px"> <asp:ListItem Selected="True"></asp:ListItem> <asp:ListItem>A</asp:ListItem> <asp:ListItem>B</asp:ListItem> <asp:ListItem>C</asp:ListItem> </asp:DropDownList><br /> <br /> Code interlocuteur:<asp:TextBox ID="A_INTERLCODETextBox" runat="server" Text='<%# Bind("A_INTERLCODE") %>' style="position: static" Width="96px"></asp:TextBox> Nom interlocuteur: <asp:TextBox ID="A_INTERLLIBTextBox" runat="server" Text='<%# Bind("A_INTERLLIB") %>' style="position: static"></asp:TextBox><br /> <br /> Tel: <asp:TextBox ID="A_INTERLTELTextBox" runat="server" Text='<%# Bind("A_INTERLTEL") %>' style="position: static"></asp:TextBox> Mail:<asp:TextBox ID="A_INTERLMAILTextBox" runat="server" Text='<%# Bind("A_INTERLMAIL") %>' style="position: static"></asp:TextBox><br /> <br /> Partenaire: <asp:CheckBox ID="CheckBox1" runat="server" Style="position: static" Text="Oui" Checked='<%# Bind("A_PARTENAIRE") %>' OnCheckedChanged="Page_Load" /> Mail commercial: <asp:TextBox ID="TextBox1" runat="server" Style="position: static;"></asp:TextBox> <br /> <br /> <br /> </asp:Panel> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> Numero : <asp:TextBox ID="A_NUMEROAPPELTextBox" runat="server" Text='<%# Bind("A_NUMEROAPPEL") %>' style="position: static"></asp:TextBox> Etat: <asp:TextBox ID="A_ETATTextBox" runat="server" Text='<%# Bind("A_ETAT") %>' style="position: static;" AutoPostBack="True"></asp:TextBox> <br /> <br /> <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:SocieteConnectionString %>" SelectCommand="SELECT [A_URGENCE] FROM [APPELS] WHERE ([A_URGENCE] = @A_URGENCE)"> <SelectParameters> <asp:ControlParameter ControlID="FormView1" Name="A_URGENCE" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> Impact: <asp:DropDownList ID="ImpactDropDownList" runat="server" AppendDataBoundItems="True" AutoPostBack="True" OnSelectedIndexChanged="Page_Load" Style="position: static" Width="152px" DataSourceID="SqlDataSource2" DataTextField="A_IMPACT" DataValueField="A_NUMEROAPPEL" SelectedValue='<%# Bind("A_IMPACT") %>'> <asp:ListItem Selected="True"></asp:ListItem> <asp:ListItem>Tout bloqué</asp:ListItem> <asp:ListItem>Serveur bloqué</asp:ListItem> <asp:ListItem>un client bloqué</asp:ListItem> <asp:ListItem>1 console bloquée</asp:ListItem> </asp:DropDownList><br /> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SocieteConnectionString %>" SelectCommand="SELECT [A_IMPACT] FROM [APPELS] WHERE ([A_IMPACT] = @A_IMPACT)"> <SelectParameters> <asp:ControlParameter ControlID="FormView1" Name="A_IMPACT" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:SqlDataSource> <br /> Priorité: <asp:DropDownList ID="PrioriteDropDownList" runat="server" AutoPostBack="True" Style="position: static" Width="152px" DataSourceID="SqlDataSource3" DataTextField="A_PRIORITE" DataValueField="A_NUMEROAPPEL" OnSelectedIndexChanged="Page_Load" SelectedValue='<%# Bind("A_PRIORITE") %>' AppendDataBoundItems="True"> <asp:ListItem Selected="True"></asp:ListItem> <asp:ListItem>Bloquant</asp:ListItem> <asp:ListItem>Non bloquant</asp:ListItem> <asp:ListItem>Rien</asp:ListItem> </asp:DropDownList> Créateur: <asp:TextBox ID="A_CREATEURTextBox" runat="server" Text='<%# Bind("A_CREATEUR") %>' AutoPostBack="True" style="position: static"></asp:TextBox><br /> <br /> Date de création: <asp:TextBox ID="A_DATECREATIONTextBox" runat="server" Text='<%# Bind("A_DATECREATION") %>' style="position: static" AutoPostBack="True" OnTextChanged="Page_Load"></asp:TextBox> Provenance: <asp:DropDownList ID="ProvenanceDropDownList" runat="server" AutoPostBack="True" Style="position: static;" Width="152px" AppendDataBoundItems="True" DataSourceID="SqlDataSource3" DataTextField="A_VECTEURAPPEL" DataValueField="A_NUMEROAPPEL" OnSelectedIndexChanged="Page_Load" SelectedValue='<%# Bind("A_VECTEURAPPEL") %>'> <asp:ListItem></asp:ListItem> <asp:ListItem>Mail</asp:ListItem> <asp:ListItem>Tel</asp:ListItem> </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:SocieteConnectionString %>" SelectCommand="SELECT [A_VECTEURAPPEL] FROM [ APPELS] WHERE ([A_VECTEURAPPEL] = @A_VECTEURAPPEL) "> <SelectParameters> <asp:ControlParameter ControlID="FormView1" Name="A_VECTEURAPPEL" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> <br /> <br /> Code produit : <asp:TextBox ID="A_PRODUITCODETextBox" runat="server" Text='<%# Bind("A_PRODUITCODE") %>' style="position: static"></asp:TextBox> Libellé produit: <asp:DropDownList ID="LibelleDropDownList" runat="server" Style="position: static" Width="160px" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="A_PRODUITLIB" DataValueField="A_NUMEROAPPEL" AppendDataBoundItems="True" OnSelectedIndexChanged="Page_Load" SelectedValue='<%# Bind("A_PRODUITLIB") %>'> <asp:ListItem Selected="True"></asp:ListItem> <asp:ListItem>MediaContact</asp:ListItem> <asp:ListItem>MediaTransfer</asp:ListItem> </asp:DropDownList><br /> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SocieteConnectionString %>" SelectCommand="SELECT [A_PRODUITLIB] FROM [APPELS] WHERE ([A_PRODUITLIB]=@A_PRODUITLIB)"> <SelectParameters> <asp:ControlParameter ControlID="FormView1" Name="A_PRODUITLIB" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> Version: <asp:TextBox ID="A_VERSIONTextBox" runat="server" Text='<%# Bind("A_VERSION") %>' style="position: static"></asp:TextBox> Evaluation: <asp:TextBox ID="A_EVALUATIONTextBox" runat="server" Text='<%# Bind("A_EVALUATION") %>' style="position: static" Width="152px"></asp:TextBox><br /> <br /> Description:<br /> <asp:TextBox ID="A_DESCRIPTIONTextBox" runat="server" Text='<%# Bind("A_DESCRIPTION") %>' Height="80px" Width="664px"></asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insérer" ></asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Annuler"></asp:LinkButton> </InsertItemTemplate> <ItemTemplate> A_NUMEROAPPEL: <asp:Label ID="A_NUMEROAPPELLabel" runat="server" Text='<%# Eval("A_NUMEROAPPEL") %>'></asp:Label><br /> A_ETAT: <asp:Label ID="A_ETATLabel" runat="server" Text='<%# Bind("A_ETAT") %>'></asp:Label><br /> A_URGENCE: <asp:Label ID="A_URGENCELabel" runat="server" Text='<%# Bind("A_URGENCE") %>'></asp:Label><br /> A_IMPACT: <asp:Label ID="A_IMPACTLabel" runat="server" Text='<%# Bind("A_IMPACT") %>'></asp:Label><br /> A_PRIORITE: <asp:Label ID="A_PRIORITELabel" runat="server" Text='<%# Bind("A_PRIORITE") %>'></asp:Label><br /> A_CREATEUR: <asp:Label ID="A_CREATEURLabel" runat="server" Text='<%# Bind("A_CREATEUR") %>'></asp:Label><br /> A_DATECREATION: <asp:Label ID="A_DATECREATIONLabel" runat="server" Text='<%# Bind("A_DATECREATION") %>'></asp:Label><br /> A_VECTEURAPPEL: <asp:Label ID="A_VECTEURAPPELLabel" runat="server" Text='<%# Bind("A_VECTEURAPPEL") %>'></asp:Label><br /> A_PRODUITCODE: <asp:Label ID="A_PRODUITCODELabel" runat="server" Text='<%# Bind("A_PRODUITCODE") %>'></asp:Label><br /> A_PRODUITLIB: <asp:Label ID="A_PRODUITLIBLabel" runat="server" Text='<%# Bind("A_PRODUITLIB") %>'></asp:Label><br /> A_VERSION: <asp:Label ID="A_VERSIONLabel" runat="server" Text='<%# Bind("A_VERSION") %>'></asp:Label><br /> A_EVALUATION: <asp:Label ID="A_EVALUATIONLabel" runat="server" Text='<%# Bind("A_EVALUATION") %>'></asp:Label><br /> A_CONTRATCODE: <asp:Label ID="A_CONTRATCODELabel" runat="server" Text='<%# Bind("A_CONTRATCODE") %>'></asp:Label><br /> A_SOCIETECODE: <asp:Label ID="A_SOCIETECODELabel" runat="server" Text='<%# Bind("A_SOCIETECODE") %>'></asp:Label><br /> A_SOCIETELIB: <asp:Label ID="A_SOCIETELIBLabel" runat="server" Text='<%# Bind("A_SOCIETELIB") %>'></asp:Label><br /> A_PARTENAIRE: <asp:Label ID="A_PARTENAIRELabel" runat="server" Text='<%# Bind("A_PARTENAIRE") %>'></asp:Label><br /> A_INTERLCODE: <asp:Label ID="A_INTERLCODELabel" runat="server" Text='<%# Bind("A_INTERLCODE") %>'></asp:Label><br /> A_INTERLLIB: <asp:Label ID="A_INTERLLIBLabel" runat="server" Text='<%# Bind("A_INTERLLIB") %>'></asp:Label><br /> A_INTERLTEL: <asp:Label ID="A_INTERLTELLabel" runat="server" Text='<%# Bind("A_INTERLTEL") %>'></asp:Label><br /> A_INTERLMAIL: <asp:Label ID="A_INTERLMAILLabel" runat="server" Text='<%# Bind("A_INTERLMAIL") %>'></asp:Label><br /> A_DESCRIPTION: <asp:Label ID="A_DESCRIPTIONLabel" runat="server" Text='<%# Bind("A_DESCRIPTION") %>'></asp:Label><br /> </ItemTemplate> <HeaderTemplate> <strong><span style="font-size: 14pt">NOUVEL APPEL</span></strong> </HeaderTemplate> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> </asp:FormView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SocieteConnectionString %>" SelectCommand="SELECT [A_NUMEROAPPEL], [A_ETAT], [A_URGENCE], [A_IMPACT], [A_PRIORITE], [A_CREATEUR], [A_DATECREATION], [A_VECTEURAPPEL], [A_PRODUITCODE], [A_PRODUITLIB], [A_VERSION], [A_EVALUATION], [A_CONTRATCODE], [A_SOCIETECODE], [A_SOCIETELIB], [A_PARTENAIRE], [A_INTERLCODE], [A_INTERLLIB], [A_INTERLTEL], [A_INTERLMAIL], [A_DESCRIPTION] FROM [APPELS]" InsertCommand="INSERT INTO APPELS(A_NUMEROAPPEL, A_ETAT, A_URGENCE, A_IMPACT, A_PRIORITE, A_CREATEUR, A_DATECREATION, A_VECTEURAPPEL, A_PRODUITCODE, A_PRODUITLIB, A_VERSION, A_EVALUATION, A_CONTRATCODE, A_SOCIETECODE, A_SOCIETELIB, A_PARTENAIRE, A_INTERLCODE, A_INTERLLIB, A_INTERLTEL, A_INTERLMAIL, A_DESCRIPTION) VALUES (@A_NUMEROAPPEL, @A_ETAT, @A_URGENCE, @A_IMPACT, @A_PRIORITE, @A_CREATEUR, @A_DATECREATION, @A_VECTEURAPPEL, @A_PRODUITCODE, @A_PRODUITLIB, @A_VERSION, @A_EVALUATION, @A_CONTRATCODE, @A_SOCIETECODE, @A_SOCIETELIB, @A_PARTENAIRE, @A_INTERLCODE, @A_INTERLLIB, @A_INTERLTEL, @A_INTERLMAIL, @A_DESCRIPTION)"> <InsertParameters> <asp:Parameter Name="A_NUMEROAPPEL" /> <asp:Parameter Name="A_ETAT" /> <asp:Parameter Name="A_URGENCE" /> <asp:Parameter Name="A_IMPACT" /> <asp:Parameter Name="A_PRIORITE" /> <asp:Parameter Name="A_CREATEUR" /> <asp:Parameter Name="A_DATECREATION" /> <asp:Parameter Name="A_VECTEURAPPEL" /> <asp:Parameter Name="A_PRODUITCODE" /> <asp:Parameter Name="A_PRODUITLIB" /> <asp:Parameter Name="A_VERSION" /> <asp:Parameter Name="A_EVALUATION" /> <asp:Parameter Name="A_CONTRATCODE" /> <asp:Parameter Name="A_SOCIETECODE" /> <asp:Parameter Name="A_SOCIETELIB" /> <asp:Parameter Name="A_PARTENAIRE" /> <asp:Parameter Name="A_INTERLCODE" /> <asp:Parameter Name="A_INTERLLIB" /> <asp:Parameter Name="A_INTERLTEL" /> <asp:Parameter Name="A_INTERLMAIL" /> <asp:Parameter Name="A_DESCRIPTION" /> </InsertParameters> </asp:SqlDataSource> </asp:Content>
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Appels_NouvelAppel1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ((TextBox)FormView1.FindControl("A_CREATEURTextBox")).Text = User.Identity.Name; ((TextBox)FormView1.FindControl("A_DATECREATIONTextBox")).Text = DateTime.Now.ToString(); ((TextBox)FormView1.FindControl("A_ETATTextBox")).Text = "Non Lu"; } }
Bon là ce n'est pas aussi évident que je le pensais :
Donc si comprends bien tu utilise la méthode GetAPPELS de ta classe DataAccess.DsAPPELSTableAdapters.SP_GET_APPELSTableAdapter pour récupérer les ligne de ton gridView.
Déjà est-ce que c'est seulement la derniere ligne insérée qui n'est pas affichée ? ou les lignes insérées avec ton FormView ? ou toutes les lignes de ta table ?
en fait c'est toutes les lignes de ma table que je rajoute qui ne sont pas prise en compte.
Citation:
Envoyé par mehdi_tn
Donc à la base c'est GetAPPELS qui ne retourne pas toutes les lignes. Il faut vérifier pourquoi la requête ne retourne pas toutes les lignes . Peut être un problème de jointure.Citation:
Envoyé par hermine
ma procédure est celle-ci dessous.
je vois pas l'erreur car ma clause where est sur A_ETAT='non lu'
car par defaut lors de l'insertion son etat est initialisé à non lu.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 ALTER PROCEDURE dbo.SP_GET_APPELS AS SELECT APPELS.A_ETAT, APPELS.A_NUMEROAPPEL, APPELS.A_SOCIETECODE, APPELS.A_SOCIETELIB, APPELS.A_URGENCE, APPELS.A_PRIORITE, APPELS.A_IMPACT, APPELS.A_CREATEUR, APPELS.A_DATECREATION, APPELS.A_VECTEURAPPEL, APPELS.A_PRODUITCODE, APPELS.A_PRODUITLIB, APPELS.A_VERSION, APPELS.A_EVALUATION, APPELS.A_CONTRATCODE, APPELS.A_PARTENAIRE, APPELS.A_INTERLCODE, APPELS.A_INTERLLIB, APPELS.A_INTERLTEL, APPELS.A_INTERLMAIL, APPELS.A_DESCRIPTION, CONTRATS_VALIDES.AFF_AFFAIRE2, V_PRODUIT_VERSION.LIB_PRODUIT, V_PRODUIT_VERSION.LIB_VERSION FROM APPELS INNER JOIN CONTRATS_VALIDES ON APPELS.A_CONTRATCODE = CONTRATS_VALIDES.AFF_AFFAIRE2 INNER JOIN V_PRODUIT_VERSION ON APPELS.A_PRODUITCODE = V_PRODUIT_VERSION.CODE_PRODUIT AND APPELS.A_VERSION = V_PRODUIT_VERSION.CODE_VERSION WHERE (APPELS.A_ETAT <> 'historisé') RETURN
Citation:
Envoyé par mehdi_tn
Est-ce qu'on est d'accord que la requête d'insertion de ton formview est la cause du problème.
Est-ce que toutes sont affichées lorsque dans ta procédure stockée tu change les inner join par des left outer join et tu supprime la clause Where :question:
bonjour mehdi
lorsque je change les inner join par les left outer join ma procédure fonctionne, maintenant je vais essayer ma formview.
je te tiens au courant.
Citation:
Envoyé par mehdi_tn
j'ai maintenant cette erreur lors de l'excution de ma gridview.
Code:
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 Erreur du serveur dans l'application '/VueSTC'. -------------------------------------------------------------------------------- Impossible d'activer les contraintes. Une ou plusieurs lignes contiennent des valeurs qui violent les contraintes de type non null, unique ou de clé externe. 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.Data.ConstraintException: Impossible d'activer les contraintes. Une ou plusieurs lignes contiennent des valeurs qui violent les contraintes de type non null, unique ou de clé externe. Erreur source: Ligne 1544 : [System.Diagnostics.DebuggerNonUserCodeAttribute()] Ligne 1545 : private void InitCommandCollection() { Ligne 1546 : this._commandCollection = new System.Data.SqlClient.SqlCommand[1]; Ligne 1547 : this._commandCollection[0] = new System.Data.SqlClient.SqlCommand(); Ligne 1548 : this._commandCollection[0].Connection = this.Connection; Fichier source : C:\dev\APPLIWeb\DataAccess\DsAPPELS.Designer.cs Ligne : 1546 Trace de la pile: [ConstraintException: Impossible d'activer les contraintes. Une ou plusieurs lignes contiennent des valeurs qui violent les contraintes de type non null, unique ou de clé externe.] System.Data.DataTable.EnableConstraints() +436 System.Data.DataTable.set_EnforceConstraints(Boolean value) +40 System.Data.DataTable.EndLoadData() +187 System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +220 System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +315 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +170 System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +160 System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +105 DataAccess.DsAPPELSTableAdapters.SP_GET_APPELSTableAdapter.GetAPPELS() in C:\dev\APPLIWeb\DataAccess\DsAPPELS.Designer.cs:1546 [TargetInvocationException: Une exception a été levée par la cible d'un appel.] System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0 System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29 System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +483 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1870 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +13 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68 System.Web.UI.WebControls.GridView.DataBind() +5 Appels_APPEL.Page_Load(Object sender, EventArgs e) +15 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45 System.Web.UI.Control.OnLoad(EventArgs e) +80 System.Web.UI.Control.LoadRecursive() +49 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3745 -------------------------------------------------------------------------------- Informations sur la version : Version Microsoft .NET Framework :2.0.50727.832; Version ASP.NET :2.0.50727.832
Citation:
Envoyé par mehdi_tn
Le message est qd meme clair là.
T'attends quoi de nous????
Ton gridview contient des données qui violent les contraintes de ta DB.
A toi de les trouver
je sais que ça me parle de contrainte et de clé externe. mais lorsque je suis ma trace je ne trouve pas.
merci je verifie toutes mes tables.
merci bcp mehdi. :D
Citation:
Envoyé par lutecefalco
le pb était au niveau de ma procédure stockée comme il s'agit d'une jointure et que je n'écris que sur une seule table.
alors j'utilise maintenant simplement une requete sql et ça marche.
Citation:
Envoyé par hermine