Monday, October 12, 2009

Hide Columns in SharePoint Part 2


Note : Before going to use this method you have to make sure all the columns are added to the list.Otherwise you have to remove the added custom form the SharePoint Designer (described in the post) and add it again after adding new column. It is better to use this way if you want hide and change control modes of fields. Also keep in mind to add at least one list item before use this method.

You can try SharePoint Tips Utility Pack if you are not sure whether you need to add columns in future or not.

In the first part of this post I discussed how to hide a column in SharePoint list. By using "Content Types" you cannot hide column in single form. Here I’m going to discuss how you can hide a column only in one (Edit, Display or New) mode using Microsoft SharePoint Designer 2007.

As an example I’m going to use the "Tasks" list and there I’ll remove "Due Date" column in Edit Mode.

First open your site using Microsoft SharePoint Designer 2007 as in Figure 1 (File --> Open Site…, in Site Name field give URL to your site without “default.aspx”. e.g. http://mysite:5050/testsite).

Then double click the displaying window and mark the "layout" hidden as in figure 2.

Then click once on area 1(Figure 3) and insert your custom list form. There select "Tasks" and "Edit item form", because we are going to change the edit form of task list (Figure 4).

Then select the row you want to hide and comment the HTML code (Figure 5).

Further if you want to display the raw in edit mode and you don’t want to allow editing it, you can change the Control mode property (Figure 6).

There keep in mind you can change control mode, if the column is not default one. That mean, to change the control mode using SharePoint Designer, you have to create your own column using "Settings –> Create Column".

Now save all and see, you will see the "Due Date" column is hidden and you cannot edit "Test Col" column (Figure 7).

14 comments:

  1. You can do this a lot easier, bij selecting to manage content type item in list settings.
    In the content type item, you select the field you want to remove from your forms and choose: This column is hidden (will not appear in forms)


    The field will not appear on new item forms and edit item forms.

    ReplyDelete
  2. Hi pietje puk,

    Thanks for commenting.
    As my experience if you use that way, those columns will hide for all the forms like edit, display and new. Using this method you can hide it in a form you want. On the other hand you can change the control mode too. I think that is a big advantage of this method.

    Anyway I’ll update my post ;)

    ReplyDelete
  3. Hi Sarang,

    Regarding 'Note' at the beginning of your post.. What kind of problem will occur if I add columns later??

    ReplyDelete
  4. Hi TBari,

    If you want to add columns later, you have to remove current custom form (Figure 3, 4) and do the same procedure again to add new form.

    ReplyDelete
  5. Hi Sarang,

    Thanks for this wonderful post. Worked like a charm for me.
    I feel this method is better than hiding the field for a content type because you can hide fields even for a form library which has a form template published.

    Cheers,

    Vicky
    SharePoint Admin
    vicky.malhar@hotmail.com

    ReplyDelete
  6. How to hide lookup columns man.....I dont want to use sharepoint designer.

    So without using ShpDesgin how to hide lookup columns

    ReplyDelete
  7. Many thanks for the great job you did

    I've been seeking for such information for a long time

    please, continue posting more and more

    Let's experience the creativity :)

    ReplyDelete
  8. I guess you couldn't read my name ! bcoz it's shown in Arabic! sorry
    My name is Ahmed Bajaber
    Again
    Thank you

    ReplyDelete
  9. Hi Ahmed Bajaber,
    No problem, I'm happy to see your valuable comments here.
    Thanks for encouraging me to write more.

    ReplyDelete
  10. Thank you very much.. Please keep on posting great things on Sharepoint.. Your post help me a lot.. May God bless you..

    ReplyDelete
  11. @ indra setyadi,
    Thanks for your valuable comment.

    ReplyDelete