DotNetNuke Tip - Module Development with Edit/View Mode

In our Engage: Publish module we load quite a few different user controls depending on who you are, and what you have access to.

One of the controls we add is an admin menu. All along we've loaded the control everytime the other controls load, assuming you are logged in as either an Admin or an Author. One thing we wanted to do for the 4.3.7 release was to hide that Admin control if you were in the "VIEW" pagemode for DotNetNuke, rather than the "EDIT" pagemode.

I tried a few different things, but it ended up being far simpler than I had expected. Where I was checking to see if a user was in the proper roles, I simple added a new check, if (IsEditMode)

It was that simple, so if you need to control your pages with different information based on the VIEW/EDIT radio buttons in DotNetNuke, just be sure to check for IsEditMode.

One note, the above is all assuming that your modules/controls are inheriting from PortalModuleBase, as IsEditMode resides in there.

4 Comments

Comments have been disabled for this content.