Bonjour à tous,

J'avais l'habitude de poster en PHP, mais voilà on me demande de retoucher un code ASP et je n'y connais absolument rien.
Je m'explique, j'ai une page qui recupère des données provenant d'une table SQL, et dans la page d'affichage, on me demande d'insérer un champ "Observation" et un bouton de validation, qui donc insererait les observations dans un champ de ma table.

Mais voilà, j'ai bien créée le champ et le bouton ok mais après je ne sais pas comment gérer les évènements...

MERCI D'AVANCE, et désolé aux modérateurs si je me trompe d'endroit pour le post, je suis un peu perdu.

voici mes pages :
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
 
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="listeStagiaires.aspx.vb" Inherits="TEST.listeStagiaires"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>listeStagiaires</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<LINK href="../Javascript_Css/styleReservation.css" type="text/css" rel="stylesheet">
	</HEAD>
	<body>
		<FORM id="frmIndex" method="post" runat="server">
			<table width="1250" border="0" cellspacing="0" cellpadding="5" class="bordure">
				<tr>
					<td><TABLE width="1250" border="0" align="center" cellPadding="3" cellSpacing="0" id="Table2"
							style="WIDTH: 1250px; HEIGHT: 75px">
							<TR class="fondGrisFonce">
								<TD style="HEIGHT: 2px" colSpan="2"><P align="center" class="texteBlanc">Administration 
										TEST</P>								</TD>
							</TR>
							<TR>
								<TD style="WIDTH: 337px" colSpan="2">&nbsp;</TD>
							</TR>
							<TR class="sousTitre">
								<TD colSpan="2">Liste des stagiaires du
									<asp:label id="lblDate" runat="server"></asp:label></TD>
							</TR>
							<TR class="sousTitre">
								<TD colSpan="2">&nbsp;</TD>
							</TR>
							<TR>
								<TD align="center" colSpan="2"></TD>
							</TR>
							<TR class="texte">
								<TD align="left" width="30%">M :</TD>
								<TD align="left"><asp:label id="lblMoniteur" runat="server"></asp:label></TD>
							</TR>
							<TR class="texte">
								<TD align="left">C :</TD>
								<TD align="left"><asp:label id="lblCentre" runat="server"></asp:label></TD>
							</TR>
							<TR class="texte">
								<TD align="left">Com :</TD>
								<TD align="left"><asp:label id="lblUser" runat="server"></asp:label></TD>
							</TR>
							<TR class="texte">
								<TD align="left">&nbsp;</TD>
								<TD align="left">&nbsp;</TD>
							</TR>
							<TR class="texte">
								<TD class="texte" align="center" colSpan="2"><asp:DataList ID="dtlCommandeInscrit" runat="server" DataKeyField="COMMANDE_ID" BackColor="White"
										BorderColor="#CC9966" BorderStyle="None" CellPadding="4" GridLines="Both" BorderWidth="1px" Width="1250px">
                                  <selecteditemstyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></selecteditemstyle>
                                  <headertemplate>
                                    <table id="Table3" cellspacing="1" cellpadding="1" width="1250px" border="0">
                                      <tr valign="top" class="texte">
                                        <td width="80px">Date de commande</td>
                                        <td width="160px">Nom / Pr&eacute;nom</td>
                                        <td width="160px">Adresse</td>
                                        <td width="90px">Téléphone</td>
                                        <td width="160px">Permis</td>
                                        <td width="90px">Date de Permis</td>
                                        <td width="90px">Mode de paiement</td>
                                        <td width="90px">Montant TTC</td>
                                        <td width="80px">Confirmé</td>
                                        <td width="200px">Observation</td>
                                        <td width="50px">Valider</td>
                                      </tr>
                                    </table>
                                  </headertemplate>
								  <footerstyle ForeColor="#ffffff" BackColor="#F2F0F0"></footerstyle>
                                  <itemstyle ForeColor="#ffffff" BackColor="#ffffff"></itemstyle>
                                  <itemtemplate>
                                    <p>
                                    <table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
                                      <tr valign="top" class="texte">
                                        <td width="80px"><asp:Label ID="lblDate2" runat="server" Text='<%# format(Container.DataItem("COMMANDE_DATE"), "d") %>' Font-Bold="True"> </asp:Label>                                        </td>
                                        <td width="160px"><asp:Label ID="lblNom" runat="server" Text='<%# Container.DataItem("INSCRIT_NOM") %>' Font-Bold="True"> </asp:Label>                                        </td>
                                        <td width="160px"><asp:Label ID="lblAdresse" runat="server" Text='<%# Container.DataItem("INSCRIT_ADRESSE") %>' Font-Bold="True"> </asp:Label>                                        </td>
                                        <td width="90px"><asp:Label ID="lblTelephone" runat="server" Text='<%# Container.DataItem("INSCRIT_TELEPHONE") %>' Font-Bold="True"> </asp:Label>                                        </td>
                                        <td width="160px"><asp:Label ID="lblpermisnum" runat="server" Text='<%# Container.DataItem("INSCRIT_PERMIS_NO") %>' Font-Bold="True"> </asp:Label>                                        </td>
                                        <td width="90px"><asp:Label ID="lblpermisdate" runat="server" Text='<%# format(Container.DataItem("INSCRIT_PERMIS_DATE"), "d") %>' Font-Bold="True"> </asp:Label>                                        </td>
                                        <td width="90px"><asp:Label ID="lblModePaiement" runat="server" Text='<%# Container.DataItem("MODE_PAIEMENT_ID") %>'> </asp:Label>                                        </td>
                                        <td width="90px"><asp:Label ID="lblMontant" runat="server" Text='<%# Container.DataItem("COMMANDE_PRIX_PRODUIT") %>'>&nbsp;&euro; </asp:Label>                                        </td>
                                        <td width="80px"><asp:CheckBox ID="chkValider" runat="server" AutoPostBack="True" Checked='<%# Container.DataItem("COMMANDE_OK") %>'> </asp:CheckBox>                                        </td>
                                        <td width="180px" height="65px"><asp:TextBox ID="txtObservation" TextMode="MultiLine" AutoPostBack="True" Rows="4" MaxLength="60"
																runat="server"></asp:TextBox>                                        </td>
                                        <td width="50px"><asp:ImageButton ID="imgBtnOk" runat="server" ImageUrl="../Images/ok.gif"></asp:ImageButton>                                        </td>
                                      </tr>
                                    </table>
                                    <p></p>
                                  </itemtemplate>
								  <headerstyle Font-Bold="True" ForeColor="#FFFFCC" BackColor="#F2F0F0"></headerstyle>
                                </asp:DataList></TD>
							</TR>
							<TR class="texte">
								<TD align="center" colSpan="2"><asp:LinkButton id="lnkBtnRetour" runat="server" class="lien1">Retour</asp:LinkButton></TD>
							</TR>
						</TABLE>
					</td>
				</tr>
			</table>
			<asp:Literal id="litDate" runat="server" Visible="False"></asp:Literal>
			<asp:Literal id="litStatut" runat="server" Visible="False" Text="0"></asp:Literal>
			<asp:Literal id="litModePaiement" runat="server" Visible="False"></asp:Literal></FORM>
	</body>
</HTML>


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
 
Imports System.Data.SqlClient
Imports TEST.Utils.Connexion
 
Public Class listeStagiaires
    Inherits System.Web.UI.Page
 
    Dim unTypeVehicule As Integer
    Dim unStage As Integer
    Dim unLieu As Integer
    Dim uneDate As Integer
    Dim unStatut As Integer
    Dim unModePaiement As String
    Protected WithEvents dtlCommandeInscrit As System.Web.UI.WebControls.DataList
    Protected WithEvents chkValider As System.Web.UI.WebControls.CheckBox
    Protected WithEvents txtObservation As System.Web.UI.WebControls.TextBox
    Protected WithEvents lnkBtnRetour As System.Web.UI.WebControls.LinkButton
    Protected WithEvents lblMoniteur As System.Web.UI.WebControls.Label
    Protected WithEvents lblCentre As System.Web.UI.WebControls.Label
    Protected WithEvents lblUser As System.Web.UI.WebControls.Label
    Protected WithEvents lblDate As System.Web.UI.WebControls.Label
    Protected WithEvents litDate As System.Web.UI.WebControls.Literal
    Protected WithEvents litStatut As System.Web.UI.WebControls.Literal
    Protected WithEvents litModePaiement As System.Web.UI.WebControls.Literal
    Dim unMoniteur As String
 
#Region " Code généré par le Concepteur Web Form "
 
    'Cet appel est requis par le Concepteur Web Form.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
 
    End Sub
 
    'REMARQUE : la déclaration d'espace réservé suivante est requise par le Concepteur Web Form.
    'Ne pas supprimer ou déplacer.
    Private designerPlaceholderDeclaration As System.Object
 
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN : cet appel de méthode est requis par le Concepteur Web Form
        'Ne le modifiez pas en utilisant l'éditeur de code.
        InitializeComponent()
    End Sub
 
#End Region
 
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        Dim laConnexion As New SqlConnection(Application("chaineConnexion"))
        Dim lAdaptateur As New SqlDataAdapter
        Dim leDts As New DataSet
        Dim laReqString As String
        Dim laCommande As SqlCommand
        Dim leReader As SqlDataReader
        Dim laConnexionUser As Utils.Connexion = New Utils.Connexion
 
        laConnexionUser.checkDroit(Session("UtilisateurId"))
 
        laConnexion.Open()
        If Not IsPostBack Then
            unTypeVehicule = CType(context.Handler, listeStagiairesCriteres).leTypeVehicule
            unStage = CType(context.Handler, listeStagiairesCriteres).leStage
            unLieu = CType(context.Handler, listeStagiairesCriteres).leLieu
            litDate.Text = CType(context.Handler, listeStagiairesCriteres).laDateReservation
            litStatut.Text = CType(context.Handler, listeStagiairesCriteres).leStatut
            litModePaiement.Text = CType(context.Handler, listeStagiairesCriteres).leModePaiement
            unMoniteur = CType(context.Handler, listeStagiairesCriteres).leMoniteur
 
            laReqString = "SELECT CALENDRIER_DATE " _
                            & "FROM STOCK " _
                            & "WHERE STOCK_ID = " & litDate.Text & " "
            laCommande = New SqlCommand(laReqString, laConnexion)
            leReader = laCommande.ExecuteReader
            If leReader.Read Then
                lblDate.Text = Format(leReader("CALENDRIER_DATE"), "d")
            End If
            leReader.Close()
            laCommande.Dispose()
 
            lblMoniteur.Text = unMoniteur
 
            laReqString = "SELECT LIEU_LIBELLE " _
                            & "FROM LIEU " _
                            & "WHERE LIEU_ID = " & unLieu & " "
            laCommande = New SqlCommand(laReqString, laConnexion)
            leReader = laCommande.ExecuteReader
            If leReader.Read Then
                lblCentre.Text = leReader("LIEU_LIBELLE")
            End If
            leReader.Close()
            laCommande.Dispose()
 
            laReqString = "SELECT ACCES_PRENOM + ' ' + ACCES_NOM AS ACCES_NOM " _
                            & "FROM ACCES " _
                            & "WHERE ACCES_ID = " & Session("UtilisateurId")
            laCommande = New SqlCommand(laReqString, laConnexion)
            leReader = laCommande.ExecuteReader
            If leReader.Read Then
                lblUser.Text = leReader("ACCES_NOM")
            End If
            leReader.Close()
            laCommande.Dispose()
        End If
 
        laReqString = "SELECT COMMANDE.COMMANDE_ID, COMMANDE_DATE, INSCRIT_NOM + ' ' + INSCRIT_PRENOM + '<br>' + INSCRIT_EMAIL AS INSCRIT_NOM, INSCRIT_ADRESSE_1 + '<br>' + INSCRIT_ADRESSE_2 + '<br>' + INSCRIT_CODE_POSTAL + ' ' + INSCRIT_VILLE AS INSCRIT_ADRESSE, INSCRIT_PERMIS_NO +'<br>'+INSCRIT_PERMIS_LIEU AS INSCRIT_PERMIS_NO, INSCRIT_PERMIS_DATE, MODE_PAIEMENT_ID, COMMANDE_PRIX_PRODUIT, " _
                & "CASE STATUT_ID WHEN " & Application("statutConfirmeId") & " THEN 1 ELSE 0 END AS COMMANDE_OK, INSCRIT_TELEPHONE " _
            & "FROM COMMANDE, LIGNE_COMMANDE, INSCRIT, STOCK " _
            & "WHERE COMMANDE.INSCRIT_ID = INSCRIT.INSCRIT_ID " _
                & "AND COMMANDE.COMMANDE_ID = LIGNE_COMMANDE.COMMANDE_ID " _
                & "AND LIGNE_COMMANDE.STOCK_ID = STOCK.STOCK_ID " _
                & "AND STOCK.STOCK_ID = " & litDate.Text & " "
        If litModePaiement.Text <> "" Then
            laReqString = laReqString & "AND MODE_PAIEMENT_ID = '" & litModePaiement.Text & "' "
        End If
        If litStatut.Text <> 0 Then
            laReqString = laReqString & "AND STATUT_ID = " & litStatut.Text & " "
        End If
        laReqString = laReqString & "ORDER BY COMMANDE_DATE, INSCRIT_NOM"
 
        lAdaptateur.Dispose()
        dtlCommandeInscrit.Dispose()
        leDts.Clear()
        lAdaptateur.SelectCommand = New SqlCommand(laReqString, laConnexion)
        lAdaptateur.Fill(leDts, "Inscrit")
        dtlCommandeInscrit.DataSource = leDts
        dtlCommandeInscrit.DataBind()
        laConnexion.Close()
 
    End Sub
 
    Private Sub lnkBtnRetour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkBtnRetour.Click
 
        Server.Transfer("listeStagiairesCriteres.aspx")
 
    End Sub
 
    Private Sub dtlCommandeInscrit_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dtlCommandeInscrit.ItemCommand
 
        Dim laConnexion As New SqlConnection(Application("chaineConnexion"))
        Dim laReqString As String
        Dim laCommande As SqlCommand
        Dim leTest As Integer
        Dim lIdCommande As Double = dtlCommandeInscrit.DataKeys(e.Item.ItemIndex)
 
        laConnexion.Open()
        laReqString = "UPDATE COMMANDE " _
                        & "SET STATUT_ID = " & Application("statutConfirmeId") & ", " _
                        & "WHERE COMMANDE_ID = " & lIdCommande & " "
        laCommande = New SqlCommand(laReqString, laConnexion)
        leTest = laCommande.ExecuteNonQuery
        laCommande.Dispose()
        laConnexion.Close()
 
    End Sub
 
 
 
 
    Private Sub dtlCommandeInscrit_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtlCommandeInscrit.SelectedIndexChanged
 
    End Sub
 
 
End Class