Bonjour,

J'aimerais savoir comment on accède à une dropdownlist dans une GridView car j'aimerais récupérer la valeur sélectionner dans la dropdownlist dans le code.

code 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
<asp:GridView ID="GVFORMATIONS" DataKeyNames="RéfParticipant"   runat="server" AutoGenerateColumns="False" 
          BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
          CellPadding="4" AllowPaging="True" CssClass= "mGrid" 
          AutoGenerateSelectButton="true" Font-Names="Calibri" Font-Size="9pt" >
          <RowStyle BackColor="White" ForeColor="#003399" />
          <Columns>
          
          
             
             <asp:TemplateField>
            <ItemTemplate >
                <asp:CheckBox  runat="server" ID="CheckBox"  HeaderText="Confirmation participation" Width="23px"  />
            </ItemTemplate>
                  <ItemStyle Width="10px" />
                   <HeaderTemplate>
                       <asp:Label ID="Lblpartici" runat="server" Text="Confirmation participation "></asp:Label> 
                   </HeaderTemplate>

             </asp:TemplateField>
             
                <asp:BoundField HeaderText="code" DataField="RéfParticipant" SortExpression="RéfParticipant" visible ="false"  >
                  <HeaderStyle Height="10px" />
              </asp:BoundField>
              
              <asp:BoundField HeaderText="Nom" DataField="NOM" SortExpression="NOM"  >
                  <HeaderStyle Height="10px" />
              </asp:BoundField>
              
              <asp:BoundField HeaderText="Prènom" DataField="PRENOM" SortExpression="PRENOM" >
                  <HeaderStyle Height="10px" />
              </asp:BoundField>
              
              <asp:BoundField HeaderText="Métier" DataField="LB_METIER" 
                  SortExpression="LB_METIER" >
                  <HeaderStyle Height="10px" />
              </asp:BoundField>
              
              <asp:BoundField HeaderText="Prévôté de rattachement" DataField="LB_SITE_AOCDTF" 
                  SortExpression="LB_SITE_AOCDTF" >
                  <HeaderStyle Height="10px" />
              </asp:BoundField>

              <asp:TemplateField>
                  
                  <ItemTemplate >
                  <asp:DropDownList ID="cbopresence" PropertyName="SelectedValue" runat="server"  HeaderText= "Présence" Width="100px" DataTextField="LB_PRESENCE" DataValueField="LB_PRESENCE"  DataSourceID="SqlDataSource1" AutoPostBack="True" >  
                </asp:DropDownList>
                  </ItemTemplate>
                  
                   <EditItemTemplate>
                   <asp:DropDownList ID="cbopresence" runat="server" DataSourceID="SqlDataSource1" DataTextField="LB_PRESENCE" DataValueField="LB_PRESENCE" SelectedValue='<%# Bind("LB_PRESENCE") %>' Enabled="True">
                </asp:DropDownList>
                  </EditItemTemplate>
                  
                  <ItemStyle Width="10px" />
                   <HeaderTemplate>
                       <asp:Label ID="Lblpresence" AutoPostBack = "true" runat="server" Text="Présence "></asp:Label> 
                   </HeaderTemplate>

             </asp:TemplateField>
  
          </Columns>
Merci d'avance