I am developing a module which involves a DataGrid and my (ultimate) objective is simply to have a confirm dialog when the user clicks "Delete" on a row using dnnConfirm. However, I just can't get it to work. I have tried to follow the wiki instructions (although worryingly these refer to v6 of DNN - I am using 7.4.0). I have copied the example straight, so I have in my ascx:
<script type="text/javascript">
$(document).ready(function () {
$('#<%= btnClear.ClientID %>').dnnConfirm({
text: 'Delete this voucher?',
yesText: 'Yes',
noText: 'No',
title: 'Confirm',
dialogClass: "dnnFormPopup",
isButton: false
});
});
</script>
<asp:LinkButton CssClass="dnnSecondaryAction dnnLogDelete" ID="btnClear" resourcekey="btnClear" runat="server" />
And I have tried various combinations of:
DotNetNuke.Framework.jQuery.RequestUIRegistration(); //obsolete?
JavaScript.RequestRegistration(CommonJs.jQueryUI);
ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn);
In my Page_Load event. But all I get is:
JavaScript runtime error: Object doesn't support property or method 'dnnConfirm'
As soon as I execute my code in debug mode. (Using VS2013, dnndev.me and Christoc template)
On the same module I have successfully implemented a JQuery UI DatePicker, so all the elements for JQuery UI would seem to be in place (Interestingly that seems to work without any of the Page_Load registration calls for JQuery UI.), I just can't work out how to initiate a dnnConfirm even on a simple, single LinkButton - what am I missing?
As a poor workaround I have put OnClientClick="return confirm('Are you sure you want to delete this voucher?');" on the Delete LinkButton, but that is not a good user interface in a DNN module and will have to try a JQuery UI Dialog, if I can't get dnnConfrim to work, but that would seem to defeat the objective.
Any help gratefully accepted.
Thanks in Advance
Nick