This Article defines that how to validate asp
dropdownlist in VB.NET.
In this article we Drag and Drop one
Dropdownlist and a Button control on the form and also drag a
RequiredFieldValidator on the form to validate dropdownlist. Here when we select
a item from the DropDownList and click on the Button control it will work fine.
But when we will click on the Button control with out select items from the
DropDownList it will show error.
For example
Now Drag and Drop one Dropdownlist and a Button
control on the form and also drag a RequiredFieldValidator on the form to
validate dropdownlist. The form looks like this.

Figure1
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication29.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub btnSubmit_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs)
If Page.IsValid Then
lblResult.Text =
dropFavoriteColor.SelectedValue
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Show
Initial Value</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label
id="lblFavoriteColor"
Text="Favorite
Color:"
AssociatedControlID="dropFavoriteColor"
Runat="server" />
<br />
<asp:DropDownList
id="dropFavoriteColor"
Runat="server">
<asp:ListItem Text="Select Color" Value="none" />
<asp:ListItem Text="Red" Value="Red" />
<asp:ListItem Text="Blue" Value="Blue" />
<asp:ListItem Text="Green" Value="Green" />
</asp:DropDownList>
<asp:RequiredFieldValidator
id="reqFavoriteColor"
Text="Please
select items from DropDownList"
InitialValue="none"
ControlToValidate="dropFavoriteColor"
Runat="server" ErrorMessage="Please
select items from DropDownList" />
<br /><br />
<asp:Button
id="btnSubmit"
Text="Submit"
Runat="server" OnClick="btnSubmit_Click" />
<hr />
<asp:Label
id="lblResult"
Runat="server" />
</div>
</form>
</body>
</html>
Now run the application and test it.

Figure2
Now we will click on the Button control with
out select items from the DropDownList it will show error.

Figure3
Now we select a item from the DropDownList and
click on the Button control it will work fine.

Figure4