Data change checking features in DotNetNuke pages.

I've used  data change checking features  described by Eric Woodruff in my ASP.NET application. When I converted the ASP.NET application to DotNetNuke, I still needed to have the same functionality.

Unfortunately .Net doesn't allow multiple inheritanse,  so I had to re-factor EWSoftware.Web.BasePage.

I created an interface IDataChangeChecking, that described the public methods, relevant to data change checking:
//described in http://www.codeproject.com/aspnet/EWSWebPt2.asp
string
[] BypassPromptIds
bool CheckForDataChanges
bool Dirty
string[] SkipDataCheckIds
StateBag ControlViewState
//expose protected ViewState

and created public class DataChangeCheckingImpl with methods extracted from original BasePage

{
      // Methods
      public DataChangeCheckingImpl(Control owner);
      public static void BypassChangesNotSavedPrompt(Control container, string ClientID);
      public static void BypassChangesNotSavedPromptIDs_Add(Control container, string[] ClientIDs);
      public void OnInit(EventArgs e);
      public void OnPreRender(EventArgs e);
      public static void SetCheckForDataChanges(Control container, bool value);
      public static bool SetPageDirty(Control container, bool Value);
      public static void SkipDataChangesCheckIDs_Add(Control container, string[] ClientIDs);

      // Properties
      public string[] BypassPromptIds { get; set; }
      public bool CheckForDataChanges { get; set; }
      public string ConfirmLeaveMessage { get; set; }
      public bool Dirty { get; set; }
      private HttpRequest Request { get; }
      public string[] SkipDataCheckIds { get; set; }
      public StateBag ViewState { get; }

      // Fields
      private bool bIsDirty;
      private Control m_ctlOwner;
      private IDataChangeChecking m_IDataChangeChecking;
}

Finally I've created DataChangeCheckingDefaultPage class, derived from DotNetNuke.Framework.CDefault and implementing IDataChangeChecking interface.

Additionaly OnInit event handler created DataChangeCheckingImpl object and methods
DataChangeCheckingImpl.OnInit and OnPreRender are called from the corresponding DataChangeCheckingDefaultPage event handlers.

Now I can configure data editing DotNetNuke modules, that user will see warning if he/she try to exit without saving data. 

posted @ Thursday, April 20, 2006 2:30 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 6 and 5 and type the answer here:
 

Live Comment Preview:

 
«September»
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011