HTML map and area tags not working for FireFox

Here was an interesting problem, what was wrong with the following code, which works fine in IE but not in FireFox

<map id="mymap">
<area ... />
<area ... />
</map>

<img usemap="#mymap" ...>


It appears that FireFox doesn't understand the id attribute and the name attribute is required.  According to W3C recommendations, http://www.w3.org/TR/REC-html40/struct/objects.html#adef-usemap the usemap attribute should match the name attribute of the map tag.

Try this instead:

<map id="mymap" name="mymap">

Customizing CSSLink and ScriptLink for public Sharepoint site

MSDN has quite a thorough topic on optimizing a Sharepoint Server for public facing site:

http://msdn.microsoft.com/en-us/library/bb727371.aspx

I would just like to add a few more points and share some thoughts on our experiences of customizing for performance in addition to this guide.

  1. Design your Sharepoint website with performance in mind.  If you had it as an after thought and think "ooh, I'll just add performance bits at the end", then your options are far more limited.  Not to mention the extra testing time you'll need.  If you are in this situation, I'd say just stick with the caching options.
  2. Most visitors to a public facing site would be anonymous users - in fact, only a very small percentage of people may actually want to modify the website.  So switch on anonymous login and start your optimizations there
  3. The easiest bits to set up are the caching options for Sharepoint.  Sharepoint Server 2007 provides 3 means of caching:
    1. Page Output Caching - this is basically ASP.NET output caching, wrapped within Sharepoint.  Follow the discussion in the article above will get you sorted.  This has the biggest performance improvement for large amount of anonymous visitors.
    2. Object Caching - this is Sharepoint caching recently accessed object's properties (and lists) so that Sharepoint doesn't have to re-access them from Database.
    3. Binary Large Objects (BLOB) caching - this is Sharepoint caching large objects that are otherwise stored in the database on a file server.  Things like pictures, javascript files, audio, SilverLight, Flash, movies, etc.  This has to be set via the web.config (defaults to 10 GB of space allocated for this).
    4. OK, these are the easy stuff - read the MSDN link if you need instructions to set this up.
  4. The article further discusses rendering core.js for only authenticated users.  This takes a bit more effort to figure out.
    1. The idea behind the RegisterCoreWhenAuthenticatedControl is good, but proper implementation requires understanding of how ScriptLink works.
    2. A ScriptLink control can be specified on the page at one point, and subsequent ScriptLink.Register will add more scripts to be added at that point.
    3. A ScriptLink control will always register core.js unless it is in minimal mode
    4. To create a ScriptLink in minimal mode, create one in the markup without the name attribute (yes.  this is really cryptic - here's why you need Reflector)
    5. <Sharepoint:ScriptLink runat="server"/>
    6. Follow by the control specified in the article:
    7. <NoCoreLoad:RegisterCoreWhenAuthenticatedControl runat="server"/>
  5. We took the idea a bit further and thought if we can get rid of the core.js file, how about get rid of the core.css file too, or in fact, anything.  What we need is a wrapper container of some sort.
    1. There are two related classes for CssLink
    2. The CssRegistration class adds CSS files to the Sharepoint context
    3. The CssLink control renders all CSS files added to the Sharepoint context
    4. The CssLink can have additional DefaultUrl and AlternativeUrl specified,  but it will always render the core.css file.  There is no minimal mode
    5. The way we use is to create a wrapper container for CssLink

      public class AuthenticatedPanel : Panel
      {
          protected override void Render(HtmlTextWriter writer)
          {
              if (HttpContext.Current.Request.IsAuthenticated)
              {
                  base.Render(writer);
              }
          }
          public override void RenderBeginTag(HtmlTextWriter writer)
          {
              //disable rendering <div>
              //base.RenderBeginTag(writer);
          }
          public override void RenderEndTag(HtmlTextWriter writer)
          {
              //disable rendering </div>
              //base.RenderEndTag(writer);
          }
      }
    6. <AuthenticatedPanel>
          <CssLink runat="server"/>
          <CssRegistration runat="server ... />
      </AuthenticatedPanel>

      <link rel="stylesheet" type="text/css" href="...path" />
  6. I like the AuthenticatedPanel that we created a lot more than the RegisterCoreWhenAuthenticatedControl - it is far more flexible in terms of the control we get on what gets rendered on the page at the end.

Good luck!

The best way to learn to customizing Sharepoint for an ASP.NET guy - use Reflector

This is probably the best best tip I'm going to share so far with regards to Sharepoint.

Think of Sharepoint as a pre-built framework on top of ASP.NET, if you are working within the confines of the multitude of options Sharepoint gives you, then you need a big thick book on Sharepoint.

If you are thinking about customizing Sharepoint, then you're beginning to face a problem I had.

How does it all work, and perhaps more importantly, why does it just not work?

You can resort to Google.  In which case, I hope you find this blog.

Or you can grab Reflector and peek inside the secrets of Microsoft.Sharepoint (WSS) and Microsoft.Sharepoint.Publishing (MOSS) assemblies.

I'll share with some findings real soon.

Tough to love Sharepoint

Recently started doing some work on Sharepoint, it's really tough to love Sharepoint.

At a glance, it seems that this is just a technology that's build on top of ASP.NET, so surely it's got all the goodness of ASP.NET + more build-in goodness.

Actually, I'd almost say it's the opposite.

It's got all the goodness of ASP.NET locked away where you can't easily use to customize your solution.

So if you are after something out of the box with light modifications, Sharepoint is really your friend.

As soon as you want heavy modifications, it feels like a complete road block.

Still, it has some really great publishing features, which distinctively makes it very compelling for an enterprise to use and set up.

I'll have more to say very soon.

Where is the DataRepeater for Silverlight?

I came across a really puzzling thing while playing with Silverlight tonight, try as I might, I couldn't find a DataRepeater style of control.

Basically, this is what I wanted to do:

<StackPanel x:Name="actions" Margin="10,0,10,5" Orientation="Horizontal" >
<HyperLinkButton Content="{Binding ActionName}" Click="Action_Click" />
</StackPanel>

And then bind these to an array of actions in the datacontext.


Sadly, StackPanel doesn't support ItemTemplates, and looking around, it seems that the only controls that supports binding collections properly are ListBox and TabControl.


The Grid control is purely for positioning.


The ItemsControl (and the child class ListBox) supports ItemTemplate, but refuses to tile my hyperlinks one after another horizontally, until the width is full and it wraps around.


Bummer.


I've settled temporarily with adding the HyperLinkButtons in the codebehind inside a foreach loop.  But not using databinding for this task makes me sad.


I will get to the bottom of this.