Page/Picture Library Settings — error at base.onLoad()

A project I’ve been working on just recently had an issue where every time someone tried to view the Library Settings for the Pages library or a Picture Library, they would receive the lovely “Object reference not found” error. At first, we thought it was something with the Pages Library content type (we had added a column for workflow purposes). But then I determined it must be something with the master page because when using the default master, the error didn’t happen.

On our custom master page, there is a custom control. Within that custom control, I used a SortedList object of type SPListItem. For whatever reason, this worked fine on one site collection but not within another site collection, BOTH on the SAME server. Very strange, still haven’t figured that one out.

But after hours of messing around with the master page, determining it was my control causing this and then trying to figure out if it was the custom content type used with the list populating my control or the control itself, I finally dwindled it down to the SortedList object. By setting it to null before exiting the control code (after all of my processing on it was complete), this fixed the error.

Very odd. Still uneasy about the fact that I can’t determine why it worked fine on one site collection and not the other.

jQuery not firing on Picture Library page

Man! Today I thought I had all of my UAT issues closed out … then the client says my Mega Menu control isn’t loading correctly. “Yes it is,” I thought, “I just tested it.” Well, it turns out they were right — it only happened on any library created with the Picture Library list template.

jQuery not loading -- menu looks odd

Thanks to this blog, I found the answer. BTW, the update works!

DOH! Referencing Visual Web Part in Master Page

Had a very huge brainfart today and I wanted to post the issue in case someone else runs into this due to lack of sleep and/or lack of concentration.

Was developing a visual web part and I kept getting the lovely “Object not set to the instance of an object” error. Debugging the code, the error was happening when I tried to load additional controls into the control I already declared in my “visual” part (the ascx file). WTF. It’s THERE! I see it! RIGHT THERE!

Well, if you declare the control within your master page, make sure you register it using the “src=~/controltemplates/yourusercontrol.ascx” and NOT the full Assembly/Namespace. OF COURSE, there’s no control! DOH!

SharePoint 2010 Ribbon tab colors

So I’ve got myself this nifty new design for a client’s SharePoint 2010 site.  I’ve changed the background of the ribbon from the original navy blue to a very light color.  Everything looks great … that is until I try to edit text or something within the page.  Then the editing tabs look like this:

Light Colored Text on Tab

Light Colored Text on Tab

And after about 15 minutes of frustrating attempts to figure out the style with IE developer toolbar, I went to the trusty Firebug and got them. Turns out Microsoft has named these according to color.

Orange tabs

.ms-cui-cg-or .ms-cui-cg-t

Green tabs

.ms-cui-cg-gr .ms-cui-cg-t

Magenta tabs — although I think it’s more of a fushia, IMO :)

.ms-cui-cg-mg .ms-cui-cg-t

Yellow tabs

.ms-cui-cg-yl .ms-cui-cg-t

Purple tabs

.ms-cui-cg-pp .ms-cui-cg-t

After tweaking my styles slightly to have the tab headers appear on my lighter background, I now have this:

Darker Text on Ribbon Tab

Darker Text on Ribbon Tab

Happy Branding!

Tricky little dynamic menu style

Updated (see bottom P.S.)

A while back I posted about an issue with the top navigation fly out menus in MOSS 2007.  Well, I’ve encountered the same issue in SharePoint 2010 but since the menu is now generated using unordered lists I had to figure it out again.  When hovering over the middle of the dynamic menu item (li.dynamic), I was getting a blue link on a blue background — not good.  What I really wanted was a white link which WOULD happen if I hovered over the edges of the dynamic menu item.  This was one issue where using Firebug instead of IE developer tools helped greatly.

blue link on blue background

Blue on Blue -- not so good

White link on Blue background

White on Blue -- much better

So here’s the offending style (what a doozie it is — so many drill downs each with their own hover!):

ul.dynamic:hover li.dynamic:hover .menu-item:hover .menu-item-text:hover
{
color:#ffffff;
}

Hope this helps someone! And you avoid the hour I spent hunting it down!

P.S.  Just encountered this with the Quick Launch as well!  Here’s the offending styles for that one:

/* .s4-ql IMPORTANT -- otherwise you'll override your previous one for the top nav! */
.menu-vertical ul.dynamic:hover li.dynamic:hover .menu-item:hover .menu-item-text:hover,
.s4-ql ul.dynamic .menu-item:hover .menu-item-text {
color:#003366;
}

Beware thee of editing HTML in wiki pages

This is actually a problem in SharePoint 2007 as well but not as easily performed there.

You see when you copy and paste a web part via the HTML view, you will break your ability to edit those web parts.  Why?  Well, if you look at the HTML view (much easier in 2010), you’ll notice that the ID in the div for the web part has been duplicated thus causing a “recognition” issue if you will for the page to be rendered correctly in edit mode.  This is easily fixed by removing one of the web parts either via the HTML view or through the web part maintenance page.

In 2007, the only way you could replicate this error (and somehow a client of ours DID “figure” this out) was to copy a web part by highlighting its entirety and pasting that into the Rich Text Editor view of a Content Editor Web Part.

I was hoping this issue would be somehow solved in 2010.  Somehow the UI would know the user was pasting a web part into the Content Editor Web Part or wiki page which has the ID of another web part on the page already but alas, no.  No biggie.  Just something to beware of!

(I will try to update this post with screenshots when it’s not 2:30 in the morning!)

Gotcha for My Site branding in 2010

I haven’t determined yet if this is the right workaround but at the time this worked.  This is definitely a gotcha to be aware of when branding my sites.

Thinking I would make life easy on myself and just use a custom CSS for My Site (including personal sites), I didn’t override the CustomMasterUrl property with my own master.  I only set the AlternateCSSUrl property in my feature to brand the overall My Site Host and in another feature which is activated upon creation of a personal my site (“My Content”). 

When deploying and creating my personal site, only the logo appeared.  Hmp.  So I looked at the source and lo, the AlternateCSSUrl?  Is placed ABOVE the portal.css when rendered.  Nice, eh?  Meaning ALL of my custom styles were overwritten by the original portal.css.

Not the end of the world.  I already had my feature written and just needed to add a few lines to set the master (which has the CSS Url hardcoded into it AFTER portal.css declaration).  But I was hoping to save myself the effort of changing the v4.master for My Site.  Oh well, lesson learned.

ms-bodyareaframe — don’t delete it!

A while back I wrote a post about the differences between MSO_ContentDiv and MSO_Content Table.  Using the wrong one on the wrong type of tag will mess up your SharePoint 2007 page royally.  But here’s another little tidbit I just ran across — you MUST use ms-bodyareaframe if you want your edit mode to render correctly.

Exhibit 1

Notice in the screenshot the tiny, itty bitty little area provided for the edit mode of a web part?  Yeah, that’s because I eliminated the ms-bodyareaframe class by accident from the table containing the content.

Exhibit 2

Now if I put that class back into the table tag containing my content area, voila!  Nice scrollable, reasonably sized edit area.

Lesson learned!

Got double breadcrumbs?

I’ve come across this from time to time and the fix is simple.  Whatever container (td, div or span) tag you are using to house your PlaceHolderTitleBreadcrumb contentplaceholder should have the “ms-titlearea” class associated with it.  Certain OOTB MS page layouts contain an extra style in the header to hide this breadcrumb when the page layout (typically a publishing layout) is rendering its own breadcrumb.   

Do this or have two different master pages, one for team sites and one for publishing sites.  I typically don’t recommend the dual master approach unless  you KNOW for certain you are going to set up the entire site for the client (possibly using site definitions) and that they won’t ever have the need to figure out for themselves which master to apply.

Hover for top nav flyout

This is another SharePoint CSS override that gets me EVERYtime because I never make time to update my base CSS to accomodate this design “flaw”. You bet you’re bippy that I’m updating my base CSS this time!

The issue occurs when a user rolls over a top navigation fly out menu item but their mouse is on the outskirts of the text and not the text itself (which is the actual link), you get the default light blue as shown below:

Top nav flyout hover issue

Yet, when a user rolls over the text itself, the entire row “highlights” as expected shown here:

Top Nav flyout hover

GRRRR!

So how to fix this? My first thought was to put a rule in for td:hover with the background color being the desired hover color. Even though that’s not proper use of the hover pseudo-class, it does work (in non-SharePoint world). Well, the answer is to make the background color of the td the non-hover color. Pretty simple. Although for some reason I would always try overriding the hover first instead of trying this route first. But not anymore dear hearts!  :)

In end, this is what  you want:

/* hover state for top nav drop down menus */
.ms-topNavFlyOuts a:hover
{
    background-color:#2a4173;
    border:none;
    color:#FFFFFF;
    width:100%;
}
.ms-topNavFlyOuts td
{
   background-color:#a44c29;
}

Also, note the width of 100% in the first rule listed.  This is why the hover on the link was working correctly and not just highlighting the link!  Both are key to getting the top navigation fly out to behave properly.  Now off to update my base CSS before I forget!

Follow

Get every new post delivered to your Inbox.