Wednesday, June 24, 2009

Is it time to B!ng?

Custom Document Library Item check-in throws error

I got the miserable "Value does not fall within the expected range" error after checking in an item in my newly created custom document library with a custom content type.

Since the cause of the error "Didn't fall within my knowledge range" I had to google ... and *bing!* found what I was looking for.

Lesson learned: Do not set the "required" attribute to true in your content type definition.

Wednesday, May 27, 2009

Accessibility: Empty text alternatives for ASP.NET image control

While building an accessible website you need to take into account that the following elements must have an ALT attribute:

  • img
  • area
  • input with type="image"
Why we need it?

The ALT attribute is designed to be an alternative text description for images.

What are the benefits?
  • Enhance the browsing experience of visitors with disabilities.
  • If somehow the image is not able to load, then a visitor will see the description of ALT attribute. This will also help when someone is using text based browsers like Lynx.
  • By having ALT attribute you are increasing the keyword density which is very good in terms of
    Search Engine Optimalisation (SEO).
What about decorative images?

The alt attribute for decorative images should be empty [alt=""] to meet the accessibility and XHML standards. If you include an empty alt attribute, screen readers will skip over the image. If you don't... the screenreader will read the entire URL of the image, which is quite annoying for the visitor.

What about the ASP.NET image control?

By default, when the AlternateText property is not set, the Image control does not include the alt attribute to specify the alternate text in the control rendering. If you set this attribute to be empty [AlternateText=""] you will notice that the control ignores it too.

Fortunately, since .NET 2.0, the image control contains a GenerateEmptyAlternateText property. It specifies whether or not the control creates an empty string as an alternate text. Set the GenerateEmptyAlternateText property to true to always include the alternate text attribute in rendered output for the Image control.

Thursday, May 7, 2009

Off-topic: Have you ever been to New York?

Take a look at that wonderful Aerial Virtual tour.

  • Turn on your speakers
  • Left below you'll find more views
  • Don't forget to enter the fullscreen
@TomPoint: Don't look at it.Within a couple weeks you'll see it in reality. :)

Wednesday, April 22, 2009

HtmlDecode RSS Feed

I had to HTMLDecode the output of the ListFeed.aspx (OOTB RSS viewer within SharePoint). After digging into the SharePoint DLL's with Reflector I overwrote the render function. To make sure this change wasn't effective for the whole environment, I made a copy of ListFeed.aspx and made a custom action (as a replacement of the OOTB 'View RSS' action) to refer to the copied file.

Tuesday, April 7, 2009

Whitespace character in XSL

I noticed that   wasn't working in my XSL file, used   instead and it worked like a charm.

Tuesday, March 31, 2009

How To: Change Styles Within RadEditor Field Control

I'm currently using the free RadEditor Lite. It's a cross-browser alternative to the default rich-text editor in MOSS and WSS v3. For those who don't know this HTML editor, take a look at Telerik. It's a well made alternative with some pros and cons. In this post I'll highlight one of it's cons: Styling within the RadEditor can be hard. I'm not talking about styling the skin - but especially about the font, background, etc.

I thought this was an easy task by just changing some CSS classes et voila...Not! My aim was to change the styling from within my own stylesheets. The difficulty was due to fact that the RadEditor is rendered in an IFrame.

  • My first attempt: override styles - with no result.
  • My second attempt: access the IFrame and add a class on it with DOM manipulation - with no result
  • Last but no least, my third attempt: access the IFrame, add a class on it and add an extra CSS Link reference in the head tag - with result.
Method: in detail
  1. Modify the ConfigFile.xml
  2. Write some javascript to access and manipulate the IFrame
  3. Create a CSS Class / File
1. The RadEditor can be configured with the ConfigFile.xml (located in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\wpresources\RadEditorSharePoint\4.5.4.0__1f131a624888eeed\RadControls\Editor)

Add an extra line: [property name="OnClientLoad"]OnClientLoad[/property]
This will tell the RadEditor to execute the OnClientLoad javascript function while loading the control.

2. Place the javascript function somewhere in a file - masterpage for instance:

(I referenced my stylesheet with document.styleSheet[x].href and added a CSS reference in my masterpage with $SPUrl: ~SiteCollection to get a relative path to the CSS file.)








3. Create a new CSS Class, named 'redEditBody', in your referenced CSS file. Now you're able to modify his styling.