I have a RadGrid Insert/Edit Form template in which I have a Submit/Update button. This button's submit behavior works perfectly if I do not reference any JavaScript calls in it. However, upon inserting an OnClientClick, it breaks the button. Here is the ASP
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' OnClientClick="return CheckWeight()" />
Here is the JavaScript:
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;
}
}
I should note that, even though the Submit functionality breaks, the OnClientClick does fire. I just cannot insert or update data in the RadGrid.
Any help is appreciated.