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  |  

telerik -- supercharge your DNN websites
  Ads  
Webhost4Life - $4.95 Windows Hosting
 


  Sponsors  

Meet Our Sponsors

SmarterTools
Verndale
The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
 


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.

 


Convert Visitors to Customers
In order to bring value to your users, we must first understand them. VIVIDSITES will help you build a custom web application and interactive marketing tools that your users will thank you for. We marry high-end creative with head banging technology to entertain and convert visitors into paying customers. Call 314.514.0505 or visit us at http://www.vividsites.com to find out how.
- V I V I D S I T E S -
Gearworx Web Hosting
As a premier provider of Web Hosting, Private/White Label hosting, Server Colocation, Dedicated Server, and other Managed Services, Gearworx offers an array of services designed to more effectively manage strategies driving businesses on the Web. Headquartered in Fremont, California our state of the art tier one data centers and distributed managed services environment enables Gearworx to offer your business enterprise level solutions through simplified processes.
Gearworx Web Hosting
Glanton: Enterprise Intranet Specialists Using DNN
Glanton Solutions are a premier provider of sevices for large corporates lloking to outsource Intranet sites.
www.glanton.com

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