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

Does the onselectedindexchanged gets Fired ?

Place a BreakPoint on it and add a value so that the Javascript test can be true.

search for REGX...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.