0

I need to remove some columns from the view that show the details of an announcement list (the view that will be displayed when clicking on an announcement item) . The URL for the view looks as follow:-

http:// gvstg01:40708/sites/Intranet/Lists/ Group%20Announcement/DispForm.aspx?ID=63&Source=http%3A%2F%2Fgvstg01%3A40708%2Fsites%2FIntranet%2FSitePages%2FHome%2Easpx&ContentTypeId=

but I cannot see this view on the available views list, under the list setting. Can anyone advice?

EDIT

i add the following code inside DispForm.aspx:-

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">

<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("hideFields");
function findacontrol(FieldName) {
   var arr = document.getElementsByTagName("!");
   // get all comments
   for (var i=0;i < arr.length; i++ )
   {
      // now match the field name
      if (arr[i].innerHTML.indexOf(FieldName) > 0)
      {         return arr[i];      }
   }
}

function hideFields() {
   var control = findacontrol("Date");
   control.parentNode.parentNode.style.display="none";

}
</script>

But still the Date field is displayed, not sure why the script was not able to hide the Date field ?

1

John,

FIRST METHOD (SHAREPOINT DESIGNER)

It is not a view, it is a display form for the List.. You can do two things, if you want to hide some columns from just the Display Form (i.e. THIS VIEW).. You can edit the DispForm.aspx page using SharePoint Designer.. Navigate to List from SharePoint Designer -> Under Forms -> DispForm.aspx (Edit)

This will have a DataFormWebPart, from Ribbon you should be able to delete fields once you select this Web Part.

SECOND METHOD (CODE)

The other way, if you want to do it programmatically is to use SPField.ShowInDisplayForm property.. You can set it to false to hide the field from Display Form

OTHER

If you want to hide your field from all the forms i.e. Display, Edit and New forms of a List.. You can turn on Management of content types from List settings and than once you have Item content type shown in List Setting -> Content Types -> Item.. You can click Item, it will display all the fields (your custom fields as well), click on a field and you have option saying, Hidden.. Check hidden to hide from Display Form, Edit Form and New Form!

  • thanks for the edit, i have followed your first approach, but when i edited the DispForm.aspx using SP designer, i can not see any reference to a column named "Date" in this form ? can you advice please? – john Gu Sep 30 '13 at 8:53
  • 1
    Do you have a column named "Date" in your list ? – Arsalan Adam Khatri Sep 30 '13 at 9:25
  • yes it is the defualt Date column ,, that comes with the announcment App ? – john Gu Sep 30 '13 at 9:39
  • 1
    You mean created and modified dates? these are contained in the footer of the display form? – Arsalan Adam Khatri Sep 30 '13 at 9:47
  • sorry i got lost, this is a customize column which i have created, it is diffenrent from the created and modified. it is a date and time column i have created... and i can not find any reference for it inside the DispForm.aspx. – john Gu Sep 30 '13 at 10:10

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.