c# - showing confirmation alert message when tinymce while moving more page to another page -
i have few web user controls in using tinymce extender editor.. , calling control in 1 aspx file on different different btn click.
i want, when edit mode , changing text in editor , without saving if leave page must ask , show confirmation alert msg want save text.
how it.
on ascx file
diagnosis:
<asp:textbox id="txbdiag" textmode="multiline" runat="server" width="100%" height="100px"></asp:textbox> <acr3s:tinymceextender runat="server" id="tinymceextender4" targetcontrolid="txbdiag" theme="full"> </acr3s:tinymceextender> </td>
extender calling is
using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.componentmodel; using system.web.ui.webcontrols; using system.globalization;
[assembly: webresource(newcasewizardbal.tinymceextender.supportscript, "text/javascript")]
namespace newcasewizardbal { [targetcontroltype(typeof(textbox))] public class tinymceextender : extendercontrol {
internal const string supportscript = "newcasewizardbal.tinymcesupport.js"; private tinymcetheme _theme = tinymcetheme.limited; private string gettheme() { switch (theme) { case tinymcetheme.limited: return "limited"; case tinymcetheme.full: return "special"; case tinymcetheme.fullwithimage: return "specialwithimage"; default: return ""; } } [defaultvalue(tinymcetheme.limited)] public tinymcetheme theme { { return _theme; } set { _theme = value; } } protected override ienumerable<scriptdescriptor> getscriptdescriptors(control targetcontrol) { return null; } protected override ienumerable<scriptreference> getscriptreferences() { return null; } protected override void onprerender(system.eventargs e) { base.onprerender(e); control targetcontrol = findcontrol(targetcontrolid); scriptmanager.registerclientscriptinclude(page, typeof(tinymceextender), "include_tiny_mce", resolveclienturl("~/scripts/tiny_mce/tiny_mce.js")); scriptmanager.registerclientscriptresource(page, typeof(tinymceextender), supportscript); scriptmanager.registerclientscriptblock(this, typeof(tinymceextender), "init" + targetcontrol.clientid, string.format(cultureinfo.invariantculture, "inittinymce ('{0}', '{1}');", targetcontrol.clientid, gettheme()), true); } } public enum tinymcetheme { limited, full, fullwithimage }
}
i can't write onclient event because calling masking script onclient click
so how of jquery or java script
i using autosave plugin not showing alert msg
do need change in tiny_mce.js
please me show confirmation alert box ask "do want save changes"
you can use client-side window.confirm()
call or onclientclick
function, like
<asp:button id="button1" runat="server" text="button" onclientclick="javascript:return window.confirm('are sure submit test?');" onclick="button1_click" />
and in code-behind:
protected void button1_click(object sender, eventargs e) { response.redirect("nextpage.aspx"); }
edit:
<script type="text/javascript"> function finalfunction () { return window.confirm('are sure submit test?'); } </script>
and call function contains both scripts:
<asp:button id="button1" runat="server" text="button" onclientclick="javascript:finalfunction();" onclick="button1_click" />
Comments
Post a Comment