DropDownList relié à Base de Données avec un Item en Static
Bonjour,
Je souhaite afficher une DropDownlist avec des données provenant d'une base de données ainsi qu'un champ en static
J'ai donc fais la chose suivante :
Code:
1 2 3 4 5 6 7 8
|
<tr>
<TD noWrap align="right" width="50%"><asp:label id="ListeProduit" runat="server">Nom du Produit :</asp:label></TD>
<TD align="left" width="50%">
<asp:dropdownlist id="DropDownListListeProduits" runat="server" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged="HideDetails"></asp:dropdownlist>
<asp:ListItem Text="Tous" Value="0" />
</TD>
</tr> |
Du côté code .NET j'ai la chose suivante :
Code:
1 2 3 4 5 6 7 8
|
cmd = Select_ListeProduits
reader = cmd.ExecuteReader()
DropDownListListeProduits.DataSource = reader
DropDownListListeProduits.DataTextField = "nom"
DropDownListListeProduits.DataValueField = "num_produit"
DropDownListListeProduits.DataBind()
reader.Close() |
Néanmoins dans ma dropdownlist je me retrouve avec toutes les données provenant de ma base de données sans ma donnée static!
Quelqu'un aurait une idée ?