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, ...Theme element manipulation?...Theme element manipulation?...
Previous
 
Next
New Post
3/30/2010 10:13 PM
 

Well, I need to programmically add or change id and class variables to the body element(s) depending on certain behaviors or the current page.  So far I'm failing to be able to initialize this variable in Default.aspx | Page_Init | InitializePage in the vb code.  My body element looks like this:

<body id="Body" class="<%=CurPage%>" runat="server" >

In the properties area I have this:

        Dim currentPage As String = "Home"
        Public Property CurPage() As String
            Get
                If currentPage <> "" Then
                    Return currentPage
                Else
                    Return "Home"
                End If
            End Get
            Set(ByVal Value As String)
                currentPage = Value
            End Set
        End Property

and in the InitializePage() I have this:

currentPage = objTab.TabName

But it's not working.  Any Suggestings?



Coding is like a box of chocolates!...

Window Vista Ultimate, RAM 8GB, 64-bit OS
Virtual Server 2005 SP1, VM - Windows Web Server 2008 R2
NVIDIA GeForce 9500 GT
Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz, VT
 
New Post
3/31/2010 5:25 AM
 

Hi

Because the body has runat="server" your method does not wok, you need to add teh complete class attribute in code

thsi code is by head so please double check :)

dim BodyClass as string="myspecialbodyclass"
Dim MyBody As Control = Me.Page.FindControl("Body")
Dim objMyBody = CType(MyBody, System.Web.UI.HtmlControls.HtmlGenericControl)
objMyBody.Attributes.Add("class", BodyClass)

But i would not do this in inline code in default.aspx. just make a skinobejct and put that in the skin

 

 

 
New Post
3/31/2010 8:00 AM
 

<body id="Body" class="<%#CurPage%>" runat="server" >

Should work, but since it's a core hack, doing this programatically is a safer option.

(you don't loose it if you upgrade DNN)

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Theme element manipulation?...Theme element manipulation?...


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