Geeks With Blogs

News My Blog has been MOVED to
Michael Freidgeim's OLD Blog My Blog has been MOVED to

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
[] 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 on Thursday, April 20, 2006 2:30 PM DotNetNuke , ASP.NET | Back to top

Comments on this post: Data change checking features in DotNetNuke pages.

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: