Search
DotNetNuke (DNN) Resource Search
Only DNN - DotNetNuke Blog
FeedBurner Subscribe to Ismet Dumlupinar's DotNetNuke Blog
31



I write a lot of content using DotNetNuke and sometimes i accidentaly press on Backspace button on my keyboard while cursor focused at outside of HTML area. This causes losing content and it is a very bad moment when you have a lot of text inside this HTML area.

I had to apply a workaround to prevent content loss when i press on Backspace button. First of all create a javascript file (e.g PreventReturn) under JS directory of your DotNetNuke installation.

Paste following text inside PreventReturn.js:

window.onbeforeunload = function() {
    if(!confirm("Are you sure you want to leave the page?")) return false;
}

Save the javascript file under js directory of your website root directory. After that you will need to call this file from controls\texteditor.ascx file.

Browse Controls directory and open the texteditor.ascx file with a text editor.

Insert:

<script language="javascript" src="/js/PreventReturn.js"></script>

After following:

<%@ Control language="vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.UserControls.TextEditor" %>
<%@ Register TagPrefix="dnn" TagName="label" Src="~/controls/labelControl.ascx" %>

Save and close the texteditor.ascx file.

This will help you to prevent returning to previous page while creating and editing content on your DotNetNuke portal. However, you will need to repeat the process everytime a new DotNetNuke release comes up and upgrades applied to your portal.
Posted in: Tutorials

Post Rating

Comments

Anonymous
# Anonymous
Sunday, January 31, 2010 5:18 AM
How to Prevent Content Loss While Editing

Post Comment

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above in the box below




Web Hosting Blogs - BlogCatalog Blog Directory

blogarama - the blog directory


Web Development blogs & blog posts

2008 - 2010 www.onlydnn.com   |  Privacy Statement  |  Terms Of Use  Xhtml 1.0  CSS 2.0