Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

$4.95 Windows Hosting at Webhost4life.com
  Ads  
OnyakTech
 


  Sponsors  

Meet Our Sponsors

DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
Verndale
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! (Pro...  Hide HTML Elements Based On Edit State
Previous Previous
 
Next Next
New Post 8/21/2008 5:08 PM
Unresolved
User is offline Jay Chuska
1 posts
10th Ranked


Hide HTML Elements Based On Edit State 

Okay - I am new to DNN but am an experienced .NETer.

What I am looking to do is hide certain elements (table/div) in my custom container based on which state the page is in - View, Edit, or Design.

In my containers I have all the edit elements in a separate section of the container and want to set the visibility to false if the state of the page is in "View" or a user isn't logged in.

Many Thanks in Advance,

J

P.S. I searched for this issue and couldn't find anything so I appoligize if there is already and answer out there.

 

 

 

 
New Post 9/25/2008 5:48 AM
User is offline Kindbergs.dk
4 posts
10th Ranked


Re: Hide HTML Elements Based On Edit State 

Hi.

This might not be the best way to do it, but it solves the problem of detecting edit mode in a container:

<asp:Panel ID="Panel1" runat="server" Style='<%# DotNetNuke.UI.Containers.Container.GetPortalModuleBase( this ).IsEditable ? "display:block;": "display:none;" %>'>
... HTML you want to hide, like tables/divs which only contains: <dnn:SOLPARTACTIONS runat="server" ID="dnnSOLPARTACTIONS" /> ..
</asp:Panel>

Oh yeah, I am a C# programmer and have no clue how to write the above in visual basic, so in order to use this you need to change the first line of the .aspx file (this of cause only works if you edit the .aspx file directly and do not parsed html files for the container):

<%@ Control Language="c#" Codebehind="~/admin/Containers/container.vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Containers.Container" %>

As I said - probably not the best solution, but it works

 

Best of luck to you!

Allan K.

 

 
New Post 9/25/2008 7:03 AM
User is offline William Severance
847 posts
www.wesnetdesigns.com
7th Ranked






Re: Hide HTML Elements Based On Edit State 

The usual DNN approach is to place your view and edit controls (elements) in a module control or skin object not in the container itself as the container simply defines the visual appearance of the area surrounding your module and includes such objects such as the module title, action menu, print/rss icon, etc.

Module controls must inherit from the base class PortalModuleBase which includes a definition for the property IsEditable. Since IsEditable will return false when the state of the page is in View mode and when edit permission has not been granted to the user's role(s) in the module settings, this checking of page state and permission has been taken care of for you.

In your module control's markup you could set the Visible attribute of an Asp.Net control that will be databound as follows:

Visible='<%# IsEditable() %>'

or in the codebehind:

tbName.Visible = IsEditable()

If you must add edit controls directly to your container (which I don't recomend and have never tried), you could obtain a reference to the contained module using the static method defined in the Container class and define your own IsEditable method as follows:

Public Function IsEditable() As Boolean
    Dim myModule As PortalModuleBase = GetPortalModuleBase(Me)
    If myModule Is Nothing Then
         Return False
    Else
         Return myModule.IsEditable()
    End If
End Function

 


Bill, WESNet Designs
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! (Pro...  Hide HTML Elements Based On Edit State
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


BataviaSoft DotNetNuke Solutions
BataviaSoft offers custom DotNetNuke solutions especially for the European and the South East Asian market.
www.bataviasoft.com
Viva Portals, L.L.C.
Expert module development and graphic design.
www.continure.com
DNN Photo Gallery
DNN Photo Gallery is a truly unique photo management module released January 1st 2006. With DNN Photo Gallery you can REALLY integrate images into your existing portal and make them look like they were designed for your site.
DNN Photo Gallery

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP