Pesky Bugs in AjaxControlToolkit

I’m not here to offer you hope. I’m simply posting my experience so if you run into the same thing, you’ll have some idea of what your options are.

I have an application – environment constrains have deemed that I use .NET 4.5 and make minimal use of 3rd party plugins as much as possible.
In this application I want my lovely users to be able to create articles; beautiful rich text articles with bolded, italicized, multicolored, multi-font sized text.

For this purpose, I decided to use an HTML Editor Extender.
It’s actually a nice Control – you can apply it to any textbox and that textbox instantly becomes a rich text editor with HTML text capabilities.

The drawback that I encountered, and the reason you are reading this, is because HTMLEditorExtender does not play nice with certain versions of Internet Explorer and ONLY in Internet Explorer.

You may not have realized it’s an error, except that when your page loads, it hangs. Sometimes it hangs with a blank dialog box sporting a ‘cancel’ button that doesn’t work.
You can try hiding the dialog with CSS, but then you notice that the page is still hanging. You’ve also noticed that the ribbon for your rich text box is rendering UNDER the textbox, and other page elements are out of place.

If you hit F12 to view the developer console, you may have noticed an “Unknown Run Time Error” in the Console Log.

There have been a few suggested workarounds:

  • Ensure the targeted text box has text or at least 3 empty spaces in it
  • Change the “http-equiv” tag to the following:<meta http-equiv=”X-UA-Compatible” content=”IE=10,chrome=1″ />

Neither of these workarounds worked for my application. When rending a blank textbox targeted by the HTMLEditorExtender, the page would load fine.
The issue occurred when I loaded a textbox targeted by the HTMLEditorExtender containing marked-up text in certain IE browsers.

If you have the option, you could instruct your users to use a different browser, or change compatibility/emulation settings in IE.
If you don’t have that option, or you realize your users are lazy and unlikely to change browsers just to view a website; then you should ditch the HTMLEditorExtender entirely and just use the HTML Editor Control.

Multiple Lists and IE9.. it continues

So when last we left, I was frantically tearing what’s left of my hair out, attempting to debug what was going on with JavaScript and Flash and Internet Explorer to make them hate each other.
As It turns out, in my scripts, I hide my flash object when it is not being directly accessed by the user. (It’s mimicking an attachment popup, so why would I have it sitting in the middle of the page unless the user wanted to attach something anyway?) I was doing this using “display: none”.
Bad, bad, bad coder!
There is a browser quirk, where if the Flash object is not rendered (e.g. “display: block”), the browser doesn’t recognize the object.
I replace the “display: none” with the “left: -5000px” trick, and viola! Flash and JavaScript and IE are talking and everyone is happy again.

A Word about SharePoint Content Types

When Editing Content types, make sure you are not editing the core content types for your site collection. Editing “Item”, “Document” or “Event” in particular by adding or removing columns and pushing the changes to all content types that depend on these will potentially ruin the functionality of your site. These content types should be locked in a bin, wrapped in chains, put inside a steamer trunk, placed inside a large concrete block and dropped into the Mariana Trench where no-one in your organization will be able to access and modify them.

I mention this as I have just had a small aneurysm after watching 2 weeks of work get blown away because someone modified the “Item” Content type, which ruined the list dependencies I had associated with my InfoPath Form, right as a client was looking at the site.

SharePoint Calendar Colors with JavaScript

Yes, there is a “codeless” way to do this using views and calendars, but you may want to use the JavaScript method to get more than just the standard colors that ship with SharePoint 2010.

How to add color coded categories to your calendars with JavaScript:

Caveats:

This solution uses Calculated Fields to display colors related to a particular category. The Category column MUST be a choice column – a lookup column will not work as look-up columns are NOT allowed in Calculated Field Column equations.

You must be able to add a Content Editor Web Part to the pages where the calendar will be viewed.

Part 1: Setting up the JavaScript:

  1. Copy the following script into a text file: