views:

756

answers:

1

Hey All,

I have a custom SharePoint page with several dataviews. The dataviews essentially filter documents matching a certain criteria from a document library and display a link to the document along with some other meta data.

The problem I have is that when a document has a single quote in it's title, the character is being rendered as ' and invalidating the link. This is the code within my custom page that is displaying the invalid link.

<A onfocus="OnLink(this)" HREF="{@FileRef}" onclick="return DispEx(this,event,'','','','','{ddwrt:ListProperty(&quot;DefaultItemOpen&quot;)}','{ddwrt:MapToControl(&quot;&quot;, string())}','{@HTML_x0020_File_x0020_Type}','','{ddwrt:GetUserID('CheckoutUser')}','{$Userid}','{ddwrt:ListProperty(&quot;ForceCheckout&quot;)}','{$FieldIDA5KNTB}','{ddwrt:CurrentRights()}')"><xsl:value-of select="ddwrt:UrlBaseName(string(@LinkFilename))" /></A>

Does anyone have any thoughts on how I can ensure the @FileRef variable is encoded correctly before being rendered?

Many thanks in advance :)

+3  A: 

you need to use the ServerURL or EncodedAbsUrl properties, this guys written it out already:

Itay Shakury's blog

Adrian
This worked spot on thanks Adrian. Still working on my rep otherwise I'd be voting it up. Thanks once again :)
Matt Woodward
You don't need rep to accept the answer.
Abs
Thanks for the heads up Abs, still finding my feet lo!
Matt Woodward