i'm working with two javascript functions
1.
function ValidateGVEducation() {
var grid = document.getElementById('<%= gvEducation.ClientID %>');
var ddlQuali, ddlUni, ddlInsti, ddlAreaS, ddlStat;
//alert(grid.rows[1].cells[2].getElementsByTagName("*")[0].value);
if (grid.rows.length > 0) {
for (var i = 1; i < 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;
}
This first function is called within another function
function validateControlsForSubmit(){
if (ValidateGVEducation()) {
alert('Fill Education Details');
return false;
}
return true;
}
In the latter function, it is then invoked in the save button. However, after showing the alert, the ASPX code behind gets executed without the 'return false' statement working properly in this context.
The function call is as follows:
<asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save"
onclientclick="return validateControlsForSubmit();" />
Thank you.