genady vaisman
genady vaisman
October 03, 2010
Stay in the know
Get helpful videos
Hello,
ever tried to use custom field properties in rendering field content on a list view in sharepoint 2010? doesn't work..
so you google it (naturally) -
you hear about a magic way to deliver - CAMLRendering=TRUE, but hey - that doesn't work !!!
you go to msdn and find out that PropertySchema and RenderPattern are obsolete, but what is the way to do it in 2010, no one tells..
after a day of searching and wondering, i want to share my findings with you.
first of all, i still don't have a clue about how it suppose to be done in SharePoint 2010, but here's a working solution that will get you through meanwhile:
1. fldtypes_MyField.xml:
leave it as it was (or should be) for Moss 2007 - with rendering pattern and property schema, etc..
important: add the following properties AllowBaseTypeRendering & CAMLRendering !
for example:
<FieldTypes>
<FieldType>
<Field Name="TypeName">MyField</Field>
<Field Name="ParentType">Text</Field>
<Field Name="TypeDisplayName">TypeDisplayName;</Field>
<Field Name="TypeShortDescription">TypeDisplayName;</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="Sortable">TRUE</Field>
<Field Name="Filterable">TRUE</Field>
<Field Name="FieldTypeClass">MyField, MyField, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...</Field>
<Field Name="FieldEditorUserControl">/_controltemplates/MyFieldFieldEditor.ascx</Field>
<Field Name="AllowBaseTypeRendering">TRUE</Field>
<Field Name="CAMLRendering">TRUE</Field>
<PropertySchema>
<Fields>
<Field Hidden="TRUE" Name="MyCustomProperty" DisplayName="MyCustomProperty" Type="Text">
</Field>
</Fields>
<Fields></Fields>
</PropertySchema>
<RenderPattern Name="HeaderPattern">
<HTML>
<![CDATA[
<script type="text/javascript" language="javascript" src="/_layouts/MyFieldHelper.js"></script>
]]>
</HTML>
<!-- copy the rest of the header pattern of base field -->
</RenderPattern>
<RenderPattern Name="DisplayPattern">
<Switch>
<Expr>
<Property Select="MyCustomProperty" HTMLEncode="TRUE"/>
</Expr>
<Case Value="">
<Column HTMLEncode="TRUE"/>
</Case>
<Default>
<Property Select="MyCustomProperty" HTMLEncode="TRUE"/>
<!-- call js function inside HTML element, like in Moss -->
</Default>
</Switch>

</RenderPattern>
</FieldType>
</FieldTypes>
2. fldtypes_MyField.xsl:
this one is new for SharePoint 2010, and it goes to Templates\Layouts\Xsl
in order to your js calls will be evaluated properly, you need these templates:
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
version="1.0"
exclude-result-prefixes="xsl msxsl ddwrt"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:SharePoint="Microsoft.SharePoint.WebControls"
xmlns:ddwrt2="urn:frontpage:internal">
<xsl:template match="FieldRef[@FieldType='MyField']" mode="header">
<th class="ms-vh2" nowrap="nowrap" scope="col" onmouseover="OnChildColumn(this)">
<script language="Javascript" type="text/javascript" src="/_layouts/MyFieldHelper.js" />
<xsl:call-template name="dvt_headerfield">
<xsl:with-param name="fieldname">
<xsl:value-of select="@Name" />
</xsl:with-param>
<xsl:with-param name="fieldtitle">
<xsl:value-of select="@DisplayName" />
</xsl:with-param>
<xsl:with-param name="displayname">
<xsl:value-of select="@DisplayName" />
</xsl:with-param>
<xsl:with-param name="fieldtype">
<xsl:value-of select="@FieldType" />
</xsl:with-param>
</xsl:call-template>
</th>
</xsl:template>
<xsl:template match="FieldRef[@FieldType='MyField']" mode="body">
<xsl:param name="thisNode" select="." />
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
all other stuff - MyField, MyFieldEditor, Field Rendering Control, custom property storage work around all remains the same.
?
?happy coding,
?Genady
Loading...

Add your comment

Comments are not meant for support. If you experiencing an issue, please open a support request.
Development
Custom SharePoint Forms and Workflows with Ultimate Forms
Riyan Arshad | January 28, 2025
As a skilled SharePoint developer, I have spent years customizing forms and workflows. My goal is...
Development
How We Automate Trial Site Creation in SharePoint
Vladi Gubler | March 27, 2025
The best way to show off your product is of course letting your potential customers try it out. In...
Development
Build Dynamic Forms with Rules
Will Cooper | February 21, 2025
Dynamic Forms are an essential part of SharePoint solutions. Dynamic Forms change in appearance and...
Build powerful business applications in SharePoint using only your browser.
100% No-Code Solution
It’s never been easier to create, innovate, and share. All you need is your web browser!
Cost-Effective
Address business process pain points immediately. Save time and money.
Fantastic Support Team
In addition to our responsive support team, a wide variety of resources, documentations, tutorials, blogs and webinars is available to you
Microsoft partner logo
© 2005-2025 Infowise Solutions Ltd. All rights reserved.
Privacy | Cookie Policy | Accessibility | Cloud SLA