function AdminValidate()
{
if(document.getElementById("txtdate").value=="")
{
alert("PLEASE ENTER DATE...");
return false;
}
<asp:DropDownList ID="drpAgentId" runat="server" AutoPostBack="True"
onselectedindexchanged="drpAgentId_SelectedIndexChanged" onchange ="return AdminValidate()" >
as in above code it works fine if txtdate is empty it alerts a but when textdate is not empty then it does nothing i mean i want to execute select query if txtdate is not empty and if txtdate is empty then show me a alert simple