Disable/Hide a colum from the Quick edit mode

i have created the following column, which represents an auto generated item number site column:-

    #Assumes that you are creating the site column in the top-level site of a site collection
    #Script can also be used to create a site column in the Content Type Hub

    #Get site and web object
    $site = Get-SPSite -Identity "http://sharepointdev:26611/sites/wiki123"
    $web = $site.RootWeb

    #Assign fieldXML variable with XML string for site column
    $fieldXML = '<Field Type="Text"
    Name="TestDate12"
    Description="This is a test date column2."
    DisplayName="Item Num2ber"
    StaticName="TestDate12"
    Group="Custom Columns"
    Hidden="FALSE"
    Required="FALSE"
    Sealed="FALSE"
    ShowInDisplayForm="TRUE"
    ShowInEditForm="FALSE"
    ShowInListSettings="TRUE"
    ShowInNewForm="FALSE">
   </Field>'

    #Output XML to console
    write-host $fieldXML

    #Create site column from XML string
    $web.Fields.AddFieldAsXml($fieldXML)

    

    #Dispose of Web and Site objects
    $web.Dispose()
    $site.Dispose() 

now since it is an auto generated number so i hide it from the Create & Edit forms, so users can not modify its value, while it is visible in the display form. but now users are able to modify its values from the quick edit grid. so is there a property similar to ShowInEditForm that disable a column from the quick edit grid ?

July 20th, 2015 8:17am

Hi,

There seems no such a property in SPField can be used to hide a field from Quick Edit View:

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield_members.aspx

As a workaround, I would suggest you disable the Quick Edit View in the list which contains this field, then users wont be able to edit this field in the Quick Edit View:

SPList.DisableGridEditing property

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.disablegridediting.aspx

Another option is that, we can apply some custom JavaScript in the list view page of this list to hide the corresponding column dynamically.

Thanks 

Free Windows Admin Tool Kit Click here and download it now
July 21st, 2015 1:37am

have you tried to customize 'new and edit form'  with Sharepoint designer?
July 21st, 2015 1:50am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics