I had a radbutton in my code and a confirm popup message.The message worked fine with the radbutton.My requirement changed and I replaced the radbutton with image button and still need a confirm popup message.I get the following error,
0x800a138f - JavaScript runtime error: Unable to get property 'set_cancel' of undefined or null reference
<asp:ImageButton ID="savebutton" runat="server" ImageUrl="~/Images/save.png" CausesValidation="true" ValidationGroup="reqvalidations" OnCommand="savebutton_Click" OnClientClick="ConfirmSave()" CommandName="Save" Enabled="true" ToolTip="Save" />
JavaScript,
function ConfirmSave(sender, args) {
if (Page_ClientValidate("reqvalidations")) {
args.set_cancel(!window.confirm("Are you sure you want to save?"));
} }
Any help is appreciated.Thanks!
I changed OnClientClick="return ConfirmSave();" and instead of args.set_cancel I used
var conf = confirm("Are you sure you want to save this request?");
if (conf== true)
return true;
return false;
User contributions licensed under CC BY-SA 3.0