Bonjour,
J'ai un DropDownList qui prend sa valeur par défaut d'une base de données (par exemple le champ: ExistOuiNon qui a comme valeur Oui ou Non). Je veux ajouter au DropDownList Oui ou Non pour permettre à l'utilisateur de changer la valeur de ExistOuiNon.
Voilà le code:
J'ai ajouté à l'intérieur de la balise asp: DropdownLis:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="ExistOuiNon" DataValueField="ExistOuiNon"> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:xxxxxx %>" SelectCommand="SELECT [ExistOuiNon] FROM [Table1] WHERE ([id] = @ID)"> <SelectParameters> <asp:QueryStringParameter Name="ID" QueryStringField="id" Type="Int32" /> </SelectParameters> </asp:SqlDataSource>
mais ça marche pas: la liste ne contient que la valeur du champ ExistOuiNon.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <asp:ListItem Text="Oui" Value="Oui"></asp:ListItem> <asp:ListItem Text="Non" Value="Non"></asp:ListItem>
Merci pour votre aide.
Partager