Bonjour,

Je développe un site intranet sous Visual Studio 2008 en .NET
J'ai quelques soucis avec quelques-unes de mes pages, et j'aurais besoin de l'aide de certains qui auraient l'expérience nécessaires pour les résoudre.

En ce qui concerne le script :

J'ai un Formview qui me permet de faire un formulaire, et d'enregistrer les données dans ma base de données. Lorsque je clique sur le bouton "Soumettre", les données sont chargées. Cependant, j'aimerais pouvoir faire une vérification des champs avant que les données soient enregistrées. J'ai donc mis dans le ItemInserting une fonction qui est censée vérifier le contenu de certains champs.

Une fois le contenu vérifié, j'aimerais que si cela ne correspond pas à ce qui est attendu (string au lieu de int par exemple), une pop-up alerte s'affiche à l'écran avec le message d'erreur. J'ai trouvé le code dans la FAQ, mais je ne sais pas pourquoi, cela ne marche pas.

En mode debbug, pas de soucis, ça marche, le code est lu et accepté, mais aucune incidence sur ma page web...

Voici le code de la fonction:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
protected void Verification(object sender, FormViewInsertEventArgs e)
        {
            #region DropDownlist
            DropDownList DropDownListOTP = (DropDownList)FormView_Test.Row.FindControl("DropDownListOTP");
 
            if (DropDownListOTP.SelectedValue == "0")
            {
                string message = "Veuillez choisir un OTP valide";
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "alert depuis le codehind", string.Format("alert('{0}')", message), true);
            }
        }

En ce qui concerne le FORMVIEW :
J'ai un formview pour ma page formulaire qui permet d'enregistrer une réservation. Ensuite, l'utilisateur a la possibilité dans la partie "Mes projets", de voir un récapitulatif de ses demandes de réservation, ainsi que la possibilité de les modifier si elles ne sont pas encore traitées.

J'ai donc un hyperlinkfield "modifier" dans mon détailsView. Ce lien renvoi donc sur un autre Formview en mode Edit, et les données enregistrées sont automatiquement chargées dans les champs qu'il faut.

Tout est fait pour que je puisse réenregistrer les données modifiées grâce à une procédure stockée, mais quand je clique sur le bouton "Modifier", les données ne sont pas éditées. Je ne comprends pas pourquoi.

Pourtant à priori, ma PS est correcte et je n'ai aucune erreur.

Voici les différents codes:

Page aspx

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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
<body>
<asp:FormView ID="FormView_ModificationReservation" runat="server" 
            DefaultMode="Edit" DataKeyNames="Demande_Numero"
            DataSourceID="dsModif" 
            onitemupdated="FormView_ModificationReservation_ItemUpdated">
            <EditItemTemplate>
                <table style="width: 100%;">
                    <tr>
                        <td class="style12">
                            <div id="Cont">
                                <div id="criti">
                                    <h2>
                                        &nbsp;Données projet</h2>
                                    <div id="clear">
                                        <div>
                                        </div>
                                        <div>
                                            <table style="width: 100%;">
                                                <tr>
                                                    <td class="style20">
                                                        &nbsp;
                                                    </td>
                                                    <td class="style19">
                                                        <asp:Label ID="LabelDonnéesProjets" runat="server" Font-Bold="True" Font-Italic="True"
                                                            Text="Données relatives au projet "></asp:Label>
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="menu_DonneesProjets">
                                            <div id="Content_DonneesProjets">
                                                <table style="width: 100%;">
                                                    <tr>
                                                        <td class="style14">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style15">
                                                            <asp:Label ID="LabelOTP" runat="server" Text="OTP" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                        </td>
                                                        <td class="style3">
                                                            <asp:TextBox ID="TextBoxOTP" runat="server" Height="18px" ReadOnly="True" 
                                                                Text='<%# Bind("Id_OTP") %>' Width="176px"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style14">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style15">
                                                            <asp:Label ID="LabelActivité" runat="server" Text="Activité" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                            <asp:RequiredFieldValidator ID="ActiviteRequired" runat="server" ControlToValidate="DropDownListActivite"
                                                                ErrorMessage="Activité is required." ToolTip="Activité is required." 
                                                                ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="style3">
                                                            <asp:DropDownList ID="DropDownListActivite" runat="server" DataSourceID="Sql_db_Plateforme_Activite"
                                                                DataTextField="Activite_Nom" DataValueField="Id_Activite" Height="21px" SelectedValue='<%# Bind("Id_Activite") %>'
                                                                Width="180px">
                                                            </asp:DropDownList>
                                                            <asp:SqlDataSource ID="Sql_db_Plateforme_Activite" runat="server" ConnectionString="<%$ ConnectionStrings:db_Plateforme_ConnectionString %>"
                                                                SelectCommand="SELECT [Id_Activite], [Activite_Nom] FROM [Activité]"></asp:SqlDataSource>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style14">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style15">
                                                            <asp:Label ID="LabelSegment" runat="server" Text="Segment" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                            <asp:RequiredFieldValidator ID="SegmentRequired" runat="server" ControlToValidate="DropDownListSegment"
                                                                ErrorMessage="Segment is required." ToolTip="Segment is required." ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="style3">
                                                            <asp:DropDownList ID="DropDownListSegment" runat="server" DataSourceID="Sql_db_Plateforme_Segment"
                                                                DataTextField="Segment_Nom" DataValueField="Id_Segment" Height="21px" SelectedValue='<%# Bind("Id_Segment") %>'
                                                                Width="180px">
                                                            </asp:DropDownList>
                                                            <asp:SqlDataSource ID="Sql_db_Plateforme_Segment" runat="server" ConnectionString="<%$ ConnectionStrings:db_Plateforme_ConnectionString %>"
                                                                SelectCommand="SELECT [Id_Segment], [Segment_Nom] FROM [Segment]"></asp:SqlDataSource>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style14">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style15">
                                                            <asp:Label ID="LabelResponsable" runat="server" Text="Responsable" Font-Bold="True"
                                                                ForeColor="Black"></asp:Label>
                                                            <asp:RequiredFieldValidator ID="ResponsableRequired" runat="server" ControlToValidate="DropDownListResponsable"
                                                                ErrorMessage="Responsable is required." ToolTip="Responsable is required." ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="style3">
                                                            <asp:DropDownList ID="DropDownListResponsable" runat="server" DataSourceID="Sql_db_Plateforme_Responsable"
                                                                DataTextField="ResponsableT_Nom" DataValueField="Id_Responsable" Height="21px"
                                                                SelectedValue='<%# Bind("Id_Responsable") %>' Width="180px">
                                                            </asp:DropDownList>
                                                            <asp:SqlDataSource ID="Sql_db_Plateforme_Responsable" runat="server" ConnectionString="<%$ ConnectionStrings:db_Plateforme_ConnectionString %>"
                                                                SelectCommand="SELECT [Id_Responsable], [ResponsableT_Nom] FROM [Responsable]">
                                                            </asp:SqlDataSource>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style14">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style15">
                                                            <asp:Label ID="LabelClient" runat="server" Text="Client" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                        </td>
                                                        <td class="style3">
                                                            <asp:TextBox ID="TextBoxClient" runat="server" Height="18px" Text='<%# Bind("Client") %>'
                                                                Width="176px"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style14">
                                                        </td>
                                                        <td class="style15">
                                                            <asp:Label ID="LabelPays" runat="server" Text="Pays" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                        </td>
                                                        <td class="style3">
                                                            <asp:TextBox ID="TextBoxPays" runat="server" Height="18px" Text='<%# Bind("Pays") %>'
                                                                Width="176px"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </td>
                        <td class="style11">
                            &nbsp;
                        </td>
                        <td class="style41">
                            <div id="Cont">
                                <div id="crit">
                                    <h2>
                                        &nbsp;Renseignements</h2>
                                    <div id="clear">
                                        <div>
                                        </div>
                                        <div>
                                            <table style="width: 100%;">
                                                <tr>
                                                    <td class="style20">
                                                        &nbsp;
                                                    </td>
                                                    <td class="style19">
                                                        <asp:Label ID="Labelrenseignements" runat="server" Font-Bold="True" Font-Italic="True"
                                                            Text="Renseignements relatifs au choix de la plateforme."></asp:Label>
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="menu_Renseignements">
                                            <div id="Content_Renseignements">
                                                <table style="width: 100%;">
                                                    <tr>
                                                        <td class="style42">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style31">
                                                            <asp:Label ID="LabelDateDébut" runat="server" Text="Date début" Font-Bold="True"
                                                                ForeColor="Black"></asp:Label>
                                                            <asp:RequiredFieldValidator ID="DateDRequired" runat="server" ControlToValidate="WebDateChooser_DateE"
                                                                ErrorMessage="La date d'entrée souhaitée is required." ToolTip="La date d'entrée souhaitée is required."
                                                                ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="style43">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style36">
                                                            <table style="width: 782%;">
                                                                <tr>
                                                                    <td class="style41">
                                                                        <igsch:WebDateChooser ID="WebDateChooser_DateE" runat="server" DayCellHeight="16"
                                                                            DayCellWidth="21" DayHeaderFormat="FirstLetter" Editable="False" GridLineColor="207, 217, 227"
                                                                            GridLineFrameVisible="False" GridLineVisible="True" Height="21px" TitleFormat="MMM yyyy"
                                                                            TitleLeftArrowHtml="&amp;lt;" TitleRightArrowHtml="&amp;gt;" Value='<%# Bind("DateDebutDemandée") %>'
                                                                            VisibleDate="2011-12-01" Width="143px">
                                                                            <CalendarLayout DayNameFormat="FirstLetter" FooterFormat="" HideOtherMonthDays="True"
                                                                                ShowFooter="False" ShowNextPrevMonth="False" ShowTitle="False">
                                                                                <CalendarStyle BackColor="#EAEAEA" BorderColor="#CFD9E3" BorderStyle="Solid" BorderWidth="1"
                                                                                    Cursor="Hand" Font-Names="verdana" Font-Size="8">
                                                                                    <BorderDetails ColorBottom="207, 217, 227" ColorLeft="207, 217, 227" ColorRight="207, 217, 227"
                                                                                        ColorTop="207, 217, 227" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </CalendarStyle>
                                                                                <DayHeaderStyle BackColor="#4FA600" CssClass="DayHeaderStyle" Font-Bold="True" Font-Names="verdana"
                                                                                    Font-Size="8" ForeColor="White" />
                                                                                <DayStyle BackColor="#EAEAEA" BorderColor="#EAEAEA" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Names="verdana" Font-Size="8" ForeColor="Blue">
                                                                                    <BorderDetails ColorBottom="234, 234, 234" ColorLeft="234, 234, 234" ColorRight="234, 234, 234"
                                                                                        ColorTop="234, 234, 234" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </DayStyle>
                                                                                <SelectedDayStyle BackColor="#EAEAEA" BorderColor="#EAEAEA" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Names="verdana" Font-Size="8" ForeColor="Red">
                                                                                    <BorderDetails ColorBottom="234, 234, 234" ColorLeft="234, 234, 234" ColorRight="234, 234, 234"
                                                                                        ColorTop="234, 234, 234" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </SelectedDayStyle>
                                                                                <TitleStyle BackColor="#4FA600" BorderColor="Black" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Bold="True" Font-Names="verdana" Font-Size="8" ForeColor="White">
                                                                                    <Padding Bottom="3px" Left="3px" Right="3px" Top="3px" />
                                                                                    <BorderDetails ColorBottom="207, 217, 227" ColorLeft="207, 217, 227" ColorRight="207, 217, 227"
                                                                                        ColorTop="207, 217, 227" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </TitleStyle>
                                                                                <WeekendDayStyle ForeColor="#FF9900" />
                                                                            </CalendarLayout>
                                                                        </igsch:WebDateChooser>
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style42">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style31">
                                                            <asp:Label ID="LabelDatefin" runat="server" Text="Date fin" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                            <asp:RequiredFieldValidator ID="DateFRequired" runat="server" ControlToValidate="WebDateChooser_DateS"
                                                                ErrorMessage="La date de sortie souhaitée is required." ToolTip="La date de sortie souhaitée is required."
                                                                ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="style43">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style36">
                                                            <table style="width: 792%;">
                                                                <tr>
                                                                    <td class="style41">
                                                                        <igsch:WebDateChooser ID="WebDateChooser_DateS" runat="server" DayCellHeight="16"
                                                                            DayCellWidth="21" DayHeaderFormat="FirstLetter" Editable="False" GridLineColor="207, 217, 227"
                                                                            GridLineFrameVisible="False" GridLineVisible="True" Height="21px" TitleFormat="MMM yyyy"
                                                                            TitleLeftArrowHtml="&amp;lt;" TitleRightArrowHtml="&amp;gt;" Value='<%# Bind("DateFinDemandee") %>'
                                                                            VisibleDate="2011-12-01" Width="143px">
                                                                            <CalendarLayout DayNameFormat="FirstLetter" FooterFormat="" HideOtherMonthDays="True"
                                                                                ShowFooter="False" ShowNextPrevMonth="False" ShowTitle="False">
                                                                                <CalendarStyle BackColor="#EAEAEA" BorderColor="#CFD9E3" BorderStyle="Solid" BorderWidth="1"
                                                                                    Cursor="Hand" Font-Names="verdana" Font-Size="8">
                                                                                    <BorderDetails ColorBottom="207, 217, 227" ColorLeft="207, 217, 227" ColorRight="207, 217, 227"
                                                                                        ColorTop="207, 217, 227" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </CalendarStyle>
                                                                                <DayHeaderStyle BackColor="#4FA600" CssClass="DayHeaderStyle" Font-Bold="True" Font-Names="verdana"
                                                                                    Font-Size="8" ForeColor="White" />
                                                                                <DayStyle BackColor="#EAEAEA" BorderColor="#EAEAEA" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Names="verdana" Font-Size="8" ForeColor="Blue">
                                                                                    <BorderDetails ColorBottom="234, 234, 234" ColorLeft="234, 234, 234" ColorRight="234, 234, 234"
                                                                                        ColorTop="234, 234, 234" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </DayStyle>
                                                                                <SelectedDayStyle BackColor="#EAEAEA" BorderColor="#EAEAEA" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Names="verdana" Font-Size="8" ForeColor="Red">
                                                                                    <BorderDetails ColorBottom="234, 234, 234" ColorLeft="234, 234, 234" ColorRight="234, 234, 234"
                                                                                        ColorTop="234, 234, 234" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </SelectedDayStyle>
                                                                                <TitleStyle BackColor="#4FA600" BorderColor="Black" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Bold="True" Font-Names="verdana" Font-Size="8" ForeColor="White">
                                                                                    <Padding Bottom="3px" Left="3px" Right="3px" Top="3px" />
                                                                                    <BorderDetails ColorBottom="207, 217, 227" ColorLeft="207, 217, 227" ColorRight="207, 217, 227"
                                                                                        ColorTop="207, 217, 227" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </TitleStyle>
                                                                                <WeekendDayStyle ForeColor="#FF9900" />
                                                                            </CalendarLayout>
                                                                        </igsch:WebDateChooser>
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style42">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style31">
                                                            <asp:Label ID="LabelSurface" runat="server" Text="Surface" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                            <asp:RequiredFieldValidator ID="ResponsableRequired2" runat="server" ControlToValidate="TextBoxSurface"
                                                                ErrorMessage="Surface is required." ToolTip="Surface is required." ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="style43">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style0">
                                                            <table style="width: 100%; height: 22px;">
                                                                <tr>
                                                                    <td class="style8">
                                                                        <asp:TextBox ID="TextBoxSurface" runat="server" Height="18px" Width="30px" Text='<%# Bind("SurfaceDemandee") %>'></asp:TextBox>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Label ID="Label13" runat="server" Text="(m²)" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style42">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style31">
                                                            <asp:Label ID="LabelPhaseProjet" runat="server" Text="Phase projet" Font-Bold="True"
                                                                ForeColor="Black"></asp:Label>
                                                        </td>
                                                        <td class="style43">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style0">
                                                            <asp:DropDownList ID="DropDownListPhaseProjet" runat="server" Height="19px" Width="125px"
                                                                DataSourceID="Sql_db_Plateforme_PhaseProjet" DataTextField="PhaseProjet_Nom"
                                                                DataValueField="Id_PhaseProjet" SelectedValue='<%# Bind("Id_PhaseProjet") %>'>
                                                            </asp:DropDownList>
                                                            <asp:SqlDataSource ID="Sql_db_Plateforme_PhaseProjet" runat="server" ConnectionString="<%$ ConnectionStrings:db_Plateforme_ConnectionString %>"
                                                                SelectCommand="SELECT [Id_PhaseProjet], [PhaseProjet_Nom] FROM [PhaseProjet]">
                                                            </asp:SqlDataSource>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="style42" rowspan="2">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style31" rowspan="2">
                                                            <asp:Label ID="LabelFAT" runat="server" Text="Date FAT" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                            <asp:RequiredFieldValidator ID="DateFATRequired" runat="server" ControlToValidate="WebDateChooser_DateFAT"
                                                                ErrorMessage="La date de FAT est requise" ToolTip="La date de FAT est requise"
                                                                ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                        </td>
                                                        <td class="style43" rowspan="2">
                                                            &nbsp;
                                                        </td>
                                                        <td class="style0">
                                                            <table style="width: 100%;">
                                                                <tr>
                                                                    <td class="style10">
                                                                        <igsch:WebDateChooser ID="WebDateChooser_DateFAT" runat="server" DayCellHeight="16"
                                                                            DayCellWidth="21" DayHeaderFormat="FirstLetter" Editable="False" GridLineColor="207, 217, 227"
                                                                            GridLineFrameVisible="False" GridLineVisible="True" Height="21px" TitleFormat="MMM yyyy"
                                                                            TitleLeftArrowHtml="&amp;lt;" TitleRightArrowHtml="&amp;gt;" Value='<%# Bind("Date_FAT") %>'
                                                                            VisibleDate="2011-12-01" Width="100px">
                                                                            <CalendarLayout DayNameFormat="FirstLetter" FooterFormat="" HideOtherMonthDays="True"
                                                                                ShowFooter="False" ShowNextPrevMonth="False" ShowTitle="False">
                                                                                <CalendarStyle BackColor="#EAEAEA" BorderColor="#CFD9E3" BorderStyle="Solid" BorderWidth="1"
                                                                                    Cursor="Hand" Font-Names="verdana" Font-Size="8">
                                                                                    <BorderDetails ColorBottom="207, 217, 227" ColorLeft="207, 217, 227" ColorRight="207, 217, 227"
                                                                                        ColorTop="207, 217, 227" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </CalendarStyle>
                                                                                <DayHeaderStyle BackColor="#4FA600" CssClass="DayHeaderStyle" Font-Bold="True" Font-Names="verdana"
                                                                                    Font-Size="8" ForeColor="White" />
                                                                                <DayStyle BackColor="#EAEAEA" BorderColor="#EAEAEA" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Names="verdana" Font-Size="8" ForeColor="Blue">
                                                                                    <BorderDetails ColorBottom="234, 234, 234" ColorLeft="234, 234, 234" ColorRight="234, 234, 234"
                                                                                        ColorTop="234, 234, 234" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </DayStyle>
                                                                                <SelectedDayStyle BackColor="#EAEAEA" BorderColor="#EAEAEA" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Names="verdana" Font-Size="8" ForeColor="Red">
                                                                                    <BorderDetails ColorBottom="234, 234, 234" ColorLeft="234, 234, 234" ColorRight="234, 234, 234"
                                                                                        ColorTop="234, 234, 234" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </SelectedDayStyle>
                                                                                <TitleStyle BackColor="#4FA600" BorderColor="Black" BorderStyle="Solid" BorderWidth="1"
                                                                                    Font-Bold="True" Font-Names="verdana" Font-Size="8" ForeColor="White">
                                                                                    <Padding Bottom="3px" Left="3px" Right="3px" Top="3px" />
                                                                                    <BorderDetails ColorBottom="207, 217, 227" ColorLeft="207, 217, 227" ColorRight="207, 217, 227"
                                                                                        ColorTop="207, 217, 227" StyleBottom="Solid" StyleLeft="Solid" StyleRight="Solid"
                                                                                        StyleTop="Solid" WidthBottom="1px" WidthLeft="1px" WidthRight="1px" WidthTop="1px" />
                                                                                </TitleStyle>
                                                                                <WeekendDayStyle ForeColor="#FF9900" />
                                                                            </CalendarLayout>
                                                                        </igsch:WebDateChooser>
                                                                    </td>
                                                                    <td class="style34">
                                                                        &nbsp;
                                                                    </td>
                                                                    <td class="style32">
                                                                        <table style="width: 96%; height: 29px;">
                                                                            <tr>
                                                                                <td class="style21">
                                                                                </td>
                                                                                <td class="style22">
                                                                                </td>
                                                                                <td class="style21">
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td>
                                                                                </td>
                                                                                <td class="style22">
                                                                                    <asp:Label ID="Label31" runat="server" Text="NbPers" Font-Bold="True" ForeColor="Black"></asp:Label>
                                                                                    <asp:RequiredFieldValidator ID="NbPersRequired" runat="server" ControlToValidate="TextBoxNbpers"
                                                                                        ErrorMessage="Nombre de personnes lors de la FAT requis." ToolTip="Nombre de personnes lors de la FAT requis."
                                                                                        ValidationGroup="Reservation">*</asp:RequiredFieldValidator>
                                                                                </td>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                                <td class="style22">
                                                                                    &nbsp;
                                                                                </td>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                    <td>
                                                                        <asp:TextBox ID="TextBoxNbpers" runat="server" Height="18px" Width="26px" Text='<%# Bind("NbPersFAT") %>'></asp:TextBox>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="style12">
                            <table style="width: 340%; height: 35px;">
                                <tr>
                                    <td>
                                        &nbsp;
                                    </td>
                                    <td class="style9" rowspan="3">
                                        &nbsp;
                                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                                            Text="Insert" Visible="False" />
                                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                            Text="Cancel" Visible="False" />
                                    </td>
                                    <td rowspan="3">
                                        <asp:Button ID="ButtonAnnuler" runat="server" Text="Annuler" Height="30px" Width="150px"
                                            Font-Bold="True" ForeColor="Black" PostBackUrl="~/AuthentificationRequise/MesProjets.aspx"
                                            CausesValidation="False" CommandName="Cancel" />
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td class="style11">
                            &nbsp;
                        </td>
                        <td class="style41">
                            <table style="width: 100%; height: 36px;">
                                <tr>
                                    <td class="style33">
                                        <table style="width: 99%;">
                                            <tr>
                                                <td class="style35">
                                                    <asp:Button ID="BoutonModifier" runat="server" Font-Bold="True"
                                                        ForeColor="Black" Height="30px" Text="Modifier" ValidationGroup="Reservation"
                                                        Width="150px" onclick="BoutonModifier_Click" />
                                                </td>
                                                <td class="style40">
                                                    <asp:TextBox ID="TextBox_User" runat="server" Text='<%# Bind("Demande_Demandeur") %>'
                                                        Visible="False" Width="10px"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:Button ID="BoutonDraft" runat="server" Font-Bold="True" ForeColor="Black" Height="30px"
                                                        Text="Draft" ValidationGroup="Reservation" Width="75px" 
                                                        onclick="BoutonDraft_Click" />
                                                </td>
                                            </tr>
                                        </table>
                                        &nbsp;</td>
                                    <td>
                                        &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </EditItemTemplate>
        </asp:FormView>
        <table style="width: 107%;">
            <tr>
                <td class="style47">
                    <asp:SqlDataSource ID="dsModif" runat="server" ConnectionString="<%$ ConnectionStrings:db_Plateforme_ConnectionString %>"
                        SelectCommand="SELECT Demande.Demande_Numero, Demande.Demande_Demandeur, Demande.Id_OTP, Demande.Id_Segment, Demande.Id_Activite, Demande.DateDebutDemandée, Demande.DateFinDemandee, Demande.SurfaceDemandee, Demande.Id_Responsable, Demande.Date_FAT, Demande.NbPersFAT, Demande.Client, Demande.Pays, Demande.Id_PhaseProjet, Demande.Commentaires, Demande.Id_PieceJointe, ListeMateriel.Comm_PC, ListeMateriel.Comm_Ecrans, ListeMateriel.Comm_Imprimantes, ListeMateriel.Comm_Armoires, ListeMateriel.Comm_Calculateurs, ListeMateriel.Comm_Protections, ListeMateriel.Nb_PC, ListeMateriel.Nb_Imprimantes, ListeMateriel.Nb_Ecrans, ListeMateriel.Nb_Armoires, ListeMateriel.Nb_Calculateurs, ListeMateriel.Nb_Protections FROM Demande CROSS JOIN ListeMateriel WHERE ([Demande_Numero] = @Demande_Numero)"
                        UpdateCommand="ModificationReservation" UpdateCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:QueryStringParameter Name="Demande_Numero" QueryStringField="ID" Type="String" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="Demande_Numero" Type="String" />
                            <asp:Parameter Name="Id_Segment" Type="Int32" />
                            <asp:Parameter Name="Id_Activite" Type="Int32" />
                            <asp:Parameter Name="DateDebutDemandée" Type="String" />
                            <asp:Parameter Name="DateFinDemandee" Type="String" />
                            <asp:Parameter Name="SurfaceDemandee" Type="String" />
                            <asp:Parameter Name="Id_Responsable" Type="Int32" />
                            <asp:Parameter Name="Date_FAT" Type="String" />
                            <asp:Parameter Name="NbPersFAT" Type="Int32" />
                            <asp:Parameter Name="Statut_Reservation" Type="Int32" />
                            <asp:Parameter Name="Client" Type="String" />
                            <asp:Parameter Name="Pays" Type="String" />
                            <asp:Parameter Name="Id_PhaseProjet" Type="Int32" />
                            <asp:Parameter Name="Commentaires" Type="String" />
                            <asp:Parameter Name="Id_PieceJointe" Type="Int32" />
                            <asp:Parameter Name="Nb_PC" Type="Int32" />
                            <asp:Parameter Name="Nb_Ecrans" Type="Int32" />
                            <asp:Parameter Name="Nb_Imprimantes" Type="Int32" />
                            <asp:Parameter Name="Nb_Armoires" Type="Int32" />
                            <asp:Parameter Name="Nb_Calculateurs" Type="Int32" />
                            <asp:Parameter Name="Nb_Protections" Type="Int32" />
                            <asp:Parameter Name="Comm_PC" Type="String" />
                            <asp:Parameter Name="Comm_Ecrans" Type="String" />
                            <asp:Parameter Name="Comm_Imprimantes" Type="String" />
                            <asp:Parameter Name="Comm_Armoires" Type="String" />
                            <asp:Parameter Name="Comm_Calculateurs" Type="String" />
                            <asp:Parameter Name="Comm_Protections" Type="String" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <asp:Label ID="Label_err" runat="server" Font-Bold="True" Font-Size="Small" ForeColor="Red"
                        Visible="False"></asp:Label>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </body>
Il n'y en a qu'une partie, mais toutes les autres sont identiques à peu de choses près, avec les mêmes liaisons vers la base de données.

PS:

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
ALTER PROCEDURE dbo.ModificationReservation
(	
	@Demande_Numero varchar(20)
	,@Demande_Demandeur varchar(50)
	,@Id_Segment int
	,@Id_Activite int
	,@DateDebutDemandée varchar(11)
	,@DateFinDemandee varchar(11)
	,@SurfaceDemandee int
	,@Id_Responsable int 
	,@Date_FAT varchar(11)
	,@NbPersFAT int
	,@Statut_Reservation varchar(50)
	,@Client varchar(50)
	,@Pays varchar(50)
	,@Id_PhaseProjet int
	,@Commentaires varchar(MAX)
	,@Id_ListeMateriel varchar(20)
	,@Nb_PC int
	,@Nb_Ecrans int
	,@Nb_Imprimantes int
	,@Nb_Armoires int
	,@Nb_Calculateurs int
	,@Nb_Protections int
	,@Comm_PC varchar(MAX)
	,@Comm_Ecrans varchar(MAX)
	,@Comm_Imprimantes varchar(MAX)
	,@Comm_Armoires varchar(MAX)
	,@Comm_Calculateurs varchar(MAX)
	,@Comm_Protections varchar(MAX)
)
 
AS
 
update [Demande]
Set [Id_Segment]=@Id_Segment, [Id_Activite]=@Id_Activite, [DateDebutDemandée]=@DateDebutDemandée, [DateFinDemandee]=@DateFinDemandee, [SurfaceDemandee]=@SurfaceDemandee, [Id_Responsable]=@Id_Responsable, [Date_FAT]=@Date_FAT, [NbPersFAT]=@NbPersFAT, [Statut_Reservation]=@Statut_Reservation, [Client]=@Client, [Pays]=@Pays, [Id_PhaseProjet]=@Id_PhaseProjet, [Commentaires]=@Commentaires
where Demande_Numero = @Demande_Numero
 
update [ListeMateriel]
Set [Nb_PC]=@Nb_PC, [Nb_Ecrans]=@Nb_Ecrans, [Nb_Imprimantes]=@Nb_Imprimantes, [Nb_Armoires]=@Nb_Armoires, [Nb_Calculateurs]=@Nb_Calculateurs, [Nb_Protections]=@Nb_Protections, [Comm_PC]=@Comm_PC, [Comm_Ecrans]=@Comm_Ecrans, [Comm_Imprimantes]=@Comm_Imprimantes, [Comm_Armoires]=@Comm_Armoires, [Comm_Calculateurs]=@Comm_Calculateurs, [Comm_Protections]=@Comm_Protections
where Id_ListeMateriel = @Id_ListeMateriel
 
RETURN @@IDENTITY
Vu que les données ne s'enregistrent pas dans la base de données, j'ai fait une fonction qui me permet de les enregistrer, directement dans le code behind en appelant ma PS, mais j'aurais préféré éviter... J'ai donc enlevé la propriétés Edit de CommandName au bouton "Modifier".

Merci par avance à ceux qui m'auront lu. Si jamais cela manque de précision, bah évidemment j'en apporterai

Cordialement

Schprounz