calling a Javascript function in if condition
<p>i have two javascript funcions</p>

<p>1.</p>

<pre><code>function ValidateGVEducation() {            

        var grid = document.getElementById('&lt;%= gvEducation.ClientID %&gt;');
        var ddlQuali, ddlUni, ddlInsti, ddlAreaS, ddlStat;

        //alert(grid.rows[1].cells[2].getElementsByTagName("*")[0].value);
        if (grid.rows.length &gt; 0) {
            for (var i = 1; i &lt; grid.rows.length; i++) {
                ddlQuali = grid.rows[i].cells[1].getElementsByTagName("*")[0];
                ddlUni = grid.rows[i].cells[2].getElementsByTagName("*")[0];
                ddlInsti = grid.rows[i].cells[3].getElementsByTagName("*")[0];
                ddlAreaS = grid.rows[i].cells[4].getElementsByTagName("*")[0];
                ddlStat = grid.rows[i].cells[6].getElementsByTagName("*")[0];
                if (ddlQuali.options[ddlQuali.selectedIndex].value != "0" ){
                    if (ddlUni.options[ddlUni.selectedIndex].value == "0" || ddlInsti.options[ddlInsti.selectedIndex].value == "0" || ddlAreaS.options[ddlAreaS.selectedIndex].value == "0" || ddlStat.options[ddlStat.selectedIndex].value == "0") {
                        alert('Fill Education Details');
                        return false;
                    }
                }

            }

            return true;
        }
        else return false;
    }
</code></pre>

<p>this function is invoke in another function</p>

<pre><code>   function validateControlsForSubmit(){
    if (ValidateGVEducation()) {
       alert('Fill Education Details');
       return false;
     }     
    return true;
   }  
</code></pre>

<p>in later function is called in save button.after showing the alert the aspx code behind is executing..
return false is not working in this case..</p>

<p>function call is </p>

<pre><code>&lt;asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save" 
                     onclientclick="return validateControlsForSubmit();"  /&gt;
</code></pre>

<p>Thank you.</p>
