if changed then save.... (howto-going crazy)

2 posts, 0 answers
  1. aykut
    aykut avatar
    67 posts
    Member since:
    Oct 2007

    Posted 14 Sep 2012 Link to this post

    dear friends,

    I need a working sample that shows me if radeditor changed or not. I cannot simply use "if radeditor1.changed then savecontent" command. there are many possibilities and solutions of the forum. keydown event is first to control, copy paste, menu events etc. there are several solutions but nobody posted a fully functional example. I coluldn't manage combine all of them: can somebody help me please, I'm going crazy for 2 days. isnt there a simple way to learn if user changed the content of radeditor ? it cannot be so hard. I'm ready to accept that I'm an idiot but couldnt make it.

    best regards...

    (to admins: I posted code library section by mistake, sorry)
  2. Rumen
    Rumen avatar
    14437 posts

    Posted 18 Sep 2012 Link to this post


    You can use the following code:

    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">
    <script type="text/javascript">
    var contentChanged = false;
    function OnClientLoad(editor) {
    editor.attachEventHandler("keydown", function(sender, e) {
    contentChanged = true;
    window.onbeforeunload = unloadMessage;
    function unloadMessage() {
    message = "Content has changed, save before exit?"
    if (contentChanged)
    return message;
    <asp:Button ID="Button1" Text="text" runat="server" />

    If the content is updated, the browser will ask the user whether she/he wants to proceed if the user tries to close the window or navigate to another page.

    Of course this is a base solution that should be enhanced by the developer working with the control.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top