Hi, you can implement a simple JavaScript validation function and call it on Button's
OnClientClick
method.
Below is the code.
aspx code
<asp:DropDownList ID="dropDown1" runat="server" AutoPostBack="false">
<asp:ListItem Text="None" />
<asp:ListItem Text="text1" />
<asp:ListItem Text="text2" />
<asp:ListItem Text="text3" />
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Submit" OnClientClick="javascript:return ValidateDropDown();" />
JavaScript Code
function ValidateDropDown() {
var cmbID = "<%=dropDown1.ClientID %>";
if (document.getElementById(cmbID).selectedIndex == 0) {
alert("Please select a Value");
return false;
}
return true;
}
Hope this will solve your problem..