I have a Sharepoint custom field with a custom string property.
It works perfectly, i can set the property by my custom custom control and the value is stored.
I want to to customize the field rendering in list view using my XSL file and according to the value of the custom property.
How can i get this value?
[EDIT]
This is the field xml defintion:
<?xml version="1.0" encoding="utf-8" ?>
<FieldTypes>
<FieldType>
<Field Name="TypeName">Secure</Field>
<Field Name="ParentType">Text</Field>
<Field Name="TypeDisplayName">Secure</Field>
<Field Name="TypeShortDescription">Secure Field</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="ShowOnListCreate">TRUE</Field>
<Field Name="ShowOnSurveyCreate">TRUE</Field>
<Field Name="ShowOnDocumentLibraryCreate">TRUE</Field>
<Field Name="ShowOnColumnTemplateCreate">TRUE</Field>
<Field Name="Sortable">FALSE</Field>
<Field Name="Filterable">FALSE</Field>
<Field Name="FieldTypeClass">MyProject.SecureFields.SecureField, $SharePoint.Project.AssemblyFullName$</Field>
<Field Name="FieldEditorUserControl">/_controltemplates/SecureFieldPropertyEditor.ascx</Field>
<PropertySchema>
<Fields>
<Field Name="ShowedFieldName" Hidden="TRUE" DisplayName="ShowedFieldName" Type="Text" MaxLength="255">
<Default></Default>
</Field>
</Fields>
</PropertySchema>
</FieldType>
</FieldTypes>
And this is the XSL:
<?xml version="1.0" encoding="utf-8"?>
<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 = 'Secure']" mode="Text_body">
<xsl:param name="thisNode" select="." />
<xsl:variable name="showedFieldName" select="./@*[name()=current()/@ShowedFieldName]" />
<span style="background-color:lightgreen;font-weight:bold">
<xsl:value-of select="$showedFieldName"/>
</span>
</xsl:template>
</xsl:stylesheet>
iam crazy from lack of MS guys and MSDN documentation.
Maybe this help, worked for my Custom Field Type (Custom property named LinkType):
…
Later, after hours of testing maybe founded solution. When I inherit my field from “SPFieldMultiLineText”, owerride “GetFieldValueAsHtml” and change field definitio it starts working.
Here is key code of working combination:
In code:
…
Somehow in SPFieldMultilinetext CAML generated value is passed to this method. So you can prepair context data from caml for processing in this method where you HAVE ACCESS to CUSTOM PROPERTIES!
Hope this helps :), and MS guys, DO SOMETHING with MSDN documentation!