Code to check that dropdownlist has value or not

Amatya
Posted by Amatya under JavaScript category on | Points: 40 | Views : 217
The below code snippet will validate that the ddlName dropdownList has value or not, if their is no selected value then alert message will be popped up saying Please Select Name

function validate() {
var ddlName = document.getElementById("<%=ddlName.ClientID%>");
if (ddlName.value == "0") {
alert("Please Select Name!");
ddlName.focus();

return false;
}


Thanks
Amatya

Comments or Responses

Login to post response