Specifying Multiple CSS Classes for #divCenter

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
11/30/2010 1:31:50 PM
Gravatar
Total Posts 156

Specifying Multiple CSS Classes for #divCenter

When specify more than one class for divCenter  panel  like so:

                    <asp:Panel ID="divLeft" runat="server" CssClass="leftside home" Visible="true">
                        <asp:ContentPlaceHolder ID="leftContent" runat="server" />
                        <portal:PageMenu id="PageMenu1" runat="server" UseTreeView="true" TreeViewShowExpandCollapse="false" />
                    </asp:Panel>
                    <asp:Panel ID="divCenter" runat="server" CssClass="center-rightandleftmargins home" Visible="true">
                        <asp:ContentPlaceHolder ID="mainContent" runat="server" />
                    </asp:Panel>
                    <asp:Panel ID="divRight" runat="server" CssClass="rightside home" Visible="true">
                        <asp:ContentPlaceHolder ID="rightContent" runat="server" />
                    </asp:Panel>

the home class never gets rendered into the output.  I'm doing the same for  divLet and divRight panels and those are fine, but it looks like the code disregards  CssClass attribute for the middle div as it's changed depending on whether there's content  in the side divs or not.

11/30/2010 8:28:30 PM
Gravatar
Total Posts 2253

Re: Specifying Multiple CSS Classes for #divCenter

Hi,

This is not a bug. It is by design. You can read all about how it works on this page: http://www.mojoportal.com/how-the-main-column-layout-works.aspx.

HTH,
Joe D.

 

11/30/2010 8:35:28 PM
Gravatar
Total Posts 156

Re: Specifying Multiple CSS Classes for #divCenter

I understand that it changes the class of the center div to one of the four.  However, I have an additional class assigned which I want to stay there.  How come it's gone?

12/1/2010 6:36:58 AM
Gravatar
Total Posts 18439

Re: Specifying Multiple CSS Classes for #divCenter

As Joe D. said, you cannot add custom css classes there because they are set programmatically by design. That is part of the magic that makes the automatic column layout work.

There are ample css classes rendered on those divs so you can either use the ones that already do render there or wrap another div around it if you really need another one. ie you don't really need a "home" css class there since it already has a unique class name that you can use to apply style.

12/1/2010 3:45:24 PM
Gravatar
Total Posts 156

Re: Specifying Multiple CSS Classes for #divCenter

Yes, I understand this is how the 3-column layout works here. It would be nice if the code was a little more intelligent and didn't strip off other classes assigned to the div, that's all.  There is a reason why I'm using "home" class.  I've worked around this because it's not really an issue, but people should be able to set more than one CssClass to the middle div and not have to worry about it being stripped off by the code just because it assigns it based on weather content in left/right column  is present or not.

12/1/2010 3:56:29 PM
Gravatar
Total Posts 18439

Re: Specifying Multiple CSS Classes for #divCenter

People are perfectly free to not use the layout.master file provided (or build your own base class for it and make it inherit from that using the same layout.master file), there is no rule that you have to use the one I wrote. You could copy the code from /App_MasterPages/layout.Master.cs into your own class with a different namespace and compile it to a dll and reference it from your layout.master file Inherits="yournamespace.yourclass"

That is a safe way you could fork the logic of layout.master and modify it to your own ideas of how things should be done.

Hope it helps,

Joe

 

12/1/2010 7:28:28 PM
Gravatar
Total Posts 156

Re: Specifying Multiple CSS Classes for #divCenter

Yes, I've already been thinking of doing that.  Will explore this option further once break starts.  Thanks Joe!

12/13/2010 5:23:55 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Specifying Multiple CSS Classes for #divCenter

Just wanted to put a pointer in here. Joe Davis came up with JavaScript code to dynamically add CSS classes to pages under the /Admin path. You may be able to adapt his script for your needs. Of course it won't be guaranteed to be effective 100% of the time (people could have JavaScript disabled in the browser), but it would probably be a lot less work than building and maintaining a new base class.

http://www.mojoportal.com/Forums/Thread.aspx?thread=6985&mid=34&pageid=5&ItemID=4&pagenumber=1#post28750

Jamie

You must sign in to post in the forums. This thread is closed to new posts.