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("DefaultItemOpen")}','{ddwrt:MapToControl("", string())}','{@HTML_x0020_File_x0020_Type}','','{ddwrt:GetUserID('CheckoutUser')}','{$Userid}','{ddwrt:ListProperty("ForceCheckout")}','{$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 🙂
you need to use the ServerURL or EncodedAbsUrl properties, this guys written it out already:
Itay Shakury’s blog