Comment verfifier le contenu d'un DropDownList
Comment peut on verifier la valeur contenu dans une dropDownList
j'ai deux DropDownList
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <asp:DropDownList ID="ListVersionB" runat="server" AppendDataBoundItems="True" Width="150px" EnableViewState="true">
<asp:ListItem>
</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ListEtatActionB" runat="server" AppendDataBoundItems="True" Width="150px" EnableViewState="true">
<asp:ListItem>
</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="buttonModif" runat="server" Height="22px" Text="Modifier" OnClick="buttonModif_Click" |
je souhaite afficher un message si l'utilisateurclick sur modifier alors que les listes sont vides
Code:
1 2 3 4 5 6 7 8 9 10 11
|
protected void buttonModif_Click(object sender, EventArgs e)
{
DropDownList listActionE = (DropDownList)Page.Master.FindControl("ListEtatActionB");
DropDownList listActionV = (DropDownList)Page.Master.FindControl("ListVersionActionB");
if ((listActionE.SelectedValue == null) && (listActionV.SelectedValue == null))
{
Response.Write("attention");
}
} |
Quelle est la syntaxe pour vérifier le contenu des listes ?