I am encountering an issue with a RadGrid Insert/Edit Form template where the Submit/Update button breaks upon adding a JavaScript call to it. The submit behavior works fine without any references to JavaScript, but as soon as I include an OnClientClick function, the button stops working as expected. Below is the ASP code for the button:
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' OnClientClick="return CheckWeight()" />
And here is the corresponding JavaScript function:
function CheckWeight() {
var currentGoalWeightTotal = $("[id$='CurrentGoalWeightTotal']").val();
var weightInput = $("[name$='AG_Weight']").val();
if (parseInt(weightInput) + parseInt(currentGoalWeightTotal) > 100) {
alert("Please make sure that your goal weight total does not exceed 100.");
return false;
}
}
While the OnClientClick event does trigger, the Submit functionality of the button is disrupted, preventing data insertion or update in the RadGrid. Any assistance on resolving this issue would be greatly appreciated.