Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Unskining with a NoSkin=1 QueryUnskining with a NoSkin=1 Query
Previous
 
Next
New Post
4/17/2007 11:11 PM
 

Hi,

I have an ascx skin and I would like to add code like below to the ascx file to just strip out all of the skin if the url contains the query ?NoSkin=1.

I am close, but I end up getting no content at all where this method would normally work in a standard asp.net page lifecycle. All I get is a single anchor in l_ContentControl.Controls. I have tried overriding both OnPreRender & OnRender.

I want to do it this way so that any page can potentially have the option of being stripped. These pages will be viewed on mobile phones in this case. But I still want the normal version to be skinned. (or else I would just make a another skin and set it on the particular page)

<script runat="server">

  Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
    Dim l_ContentControl As System.Web.UI.Control
  
    If (Me.Request.QueryString.Item("NoSkin") Is Nothing) Then Return

    l_ContentControl = Me.FindControl("ContentPane")
    If (l_ContentControl Is Nothing) Then Return

    l_ContentControl.Parent.Controls.Remove(l_ContentControl)
    Me.Controls.Clear()

    For Each l_ChildControl As System.Web.UI.Control In l_ContentControl.Controls
     l_ChildControl.Parent.Controls.Remove(l_ChildControl)
     Me.Controls.Add(l_ChildControl)
    Next
  End Sub

</script>

 

 

 
New Post
4/18/2007 7:00 AM
 

I think the problem is that you are removing the contenpane.

That's where the content is and the page is empty afterwards.

I would unload the CSS files, not the content...

You might also have a look at John Mitchell's post in this thread

 
New Post
4/18/2007 7:24 AM
 

Hi Timo,

Yes removing the content pane, but then looping through its child controls and addig them back.

So I expect it to start out looking like this..

<Skin Stuff>

<ContentPane>

<Module 1 Output>

<Module 2 Output>

<ContentPane>

<Skin Stuff>

And then my code transforms it to this..

<Module 1 Output>

<Module 2 Output>

ie. all of the content pane and skin have been stripped from the output and just the modules output html code remains.

The problem I am having is that when OnPreRender & even OnRender is called, then <Module 1 Output> etc.. does not exist and the only thing I find in l_ContentControl.Controls is a single anchor. eg. <a id="392"></a>

I think DNN is rendering the modules individually, and then merging them with the page after it has gone through the OnRender event, I assume for caching.. as this kind of code would work in the standard ASP.NET page lifecycle.

 

 
New Post
4/18/2007 7:35 AM
 

PS: I need to remove more than just the CSS styling, I need to change the underlying structure of the html, ie. I don't want to send the menu's down, etc.. as it will be to a mobile device. (that just needs to view the module content as clearly as possible and save a bit of bandwidth as a bonus) "IF" the skin & dnn modiles were all xhtml/css based then I could easily use a stylesheet to target the mobile device and get the desired viewing just as you suggest.   (but that seems to be a long way off)

Also I know I could make a hidden page, assign a bare bones skin to it, and add references to the rich pages modules.. but I think the maintenance involved in this approach would be the killer.

 
New Post
4/18/2007 1:59 PM
 

Okay... Sorry for that.

Nice idea couldn't exactly say why your code doesn't work, but you could also unload the CSS files, or load the noskin skin instead of the one assigned...

If you solve this would you post the solution please?

Thanks,

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Unskining with a NoSkin=1 QueryUnskining with a NoSkin=1 Query


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out