3

I have written a custom field type with this definition (to be used in SP2010):

<FieldTypes>
  <FieldType>
    <Field Name="TypeName">MyField</Field>
    <Field Name="ParentType">Number</Field>
    <Field Name="TypeDisplayName">My Field</Field>
    <Field Name="TypeShortDescription">My field description</Field>
    <Field Name="AllowBaseTypeRendering">TRUE</Field>
    <Field Name="UserCreatable">FALSE</Field>
    <Field Name="FieldTypeClass">$SharePoint.Type.3e27f5e8-348d-40c6-afcc-87306b2bb3ac.AssemblyQualifiedName$</Field>
    <Field Name="Sortable">TRUE</Field>
    <Field Name="Filterable">TRUE</Field>
  </FieldType>
</FieldTypes>

Basically, this custom field extend the native SPFieldNumber to provide a custom UI:

[Guid("3E27F5E8-348D-40C6-AFCC-87306B2BB3AC")]
public class MyField: SPFieldNumber
{
    public MyField(SPFieldCollection fields, string fieldName)
        : base(fields, fieldName)
    {
    }

    public MyField(SPFieldCollection fields, string typeName, string displayName)
        : base(fields, typeName, displayName)
    {
    }

    public override Microsoft.SharePoint.WebControls.BaseFieldControl FieldRenderingControl
    {
        get
        {
            return new MyFieldControl
            {
                FieldName = this.InternalName,
            };
        }
    }
}

The custom field works fine in the standard newform.aspx and editform.aspx. However, when I create a datasheet view, the field is read only:

enter image description here

What have I to do to make the field editable in the datasheet view?

3

This is SharePoint behavior. Custom fields are not editable in datasheet view.

  • I'm still eager to find some hack to override this issue (but I'm realistic, it will probably won't be possible). – Steve B Sep 20 '13 at 9:29
  • I would love to see if there is any hack. A user had requested me once to provide edit functionality to my custom field control "Autocomplete Lookup Field" autocompletelookup.codeplex.com/discussions/361944 – Nadeem Yousuf Sep 20 '13 at 11:01
  • Is there any Microsoft link reference for this? I would appreciate if you can provide me such link. It will be very helpful then. Thanks in advance. – Dikesh Gandhi Nov 16 '17 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.