Bonjour,
Je me suis créé un contrôle utilisateur me permettant d'afficher une tâche. J'ai opté pour un contrôle utilisateur car il peut avoir plusieurs tâches à afficher sur une même page.
Mon problème provient d'un DropDownList. En effet, lorsque je sélectionne un élément dans cette liste, l'évènement SelectedIndexChanged ne s'exécute pas comme il devrait le faire.
Pourriez vous m'aider à trouver une solution svp.
Code de mon contrôle utilisateur :
Code du SelectedIndexChanged :
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 <%@ Control Language="VB" AutoEventWireup="false" ClassName="CtrlTache" CodeFile="CtrlTache.ascx.vb" Inherits="CtrlTache" %> <dt> <asp:table ID="test" runat="server" Width="100%"> <asp:TableRow> <asp:TableCell>Tâche attribuée à : <asp:Label ID="lblAdminTache" runat="server" text=""/></asp:TableCell> <asp:TableCell>Date début : <asp:Label ID="lblDatetache" runat="server" text=""/></asp:TableCell> <asp:TableCell>Heure début : <asp:Label ID="lblHeureTache" runat="server" text=""/></asp:TableCell> </asp:TableRow> </asp:table> </dt> <dd> <asp:table ID="tblInformation" runat="server" Width="100%"> <asp:TableRow HorizontalAlign="Right"> <asp:TableCell> <div id="options" style="text-align:right"> Etat de la tâche : <asp:DropDownList ID="lbListeTache" runat="server" DataSourceID="ListeEtatTache" DataTextField="ETATTALibelle" DataValueField="ETATTAId" AutoPostBack="true"> </asp:DropDownList> <asp:AccessDataSource ID="ListeEtatTache" runat="server" DataFile="~/App_Data/IncidentENSAM.mdb" SelectCommand="SELECT [ETATTAId], [ETATTALibelle] FROM [ETATTACHE] ORDER BY [ETATTAId]"> </asp:AccessDataSource> Editer : <a href="Edit.aspx?demande=<% Response.Write(i_IdDemande) %>tache=<% Response.Write(i_IdTache) %>"> <img src="../images/icones/crayon116.png" alt="Editer" title="Editer" style="cursor:pointer; border-width:0px;" /></a> Supprimer : <span style="cursor:pointer;"> <asp:Image ID="imgSupprimer" ImageUrl="~/images/icones/annule16.png" runat="server" /> </span> </div> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell ID="CellInformations" ColumnSpan="3"></asp:TableCell> </asp:TableRow> </asp:table> </dd>
Les contrôles utilisateur sont ajoutés sur une page dans un PlaceHolder via le code VB.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Protected Sub EtatTacheChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles lbListeTache.SelectedIndexChanged Dim o_Exec As OleDbCommand Dim i_IdEtatTache As Integer = lbListeTache.SelectedValue Dim s_Requete As String s_Requete = "UPDATE TACHE SET TACHEEtatTache=" & i_IdEtatTache & " " s_Requete = "WHERE TACHEIdDemande=" & i_IdDemande & " AND TACHEId=" & i_IdTache & "" o_Exec = New OleDbCommand(s_Requete, o_SI.Connexion) ' il faut faire la suite End Sub
Merci d'avance
Partager