SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im currently working in SharePoint 2007 Page Layout, I have Site Columns created to be drag and drop into custom page layout via SharePoint Designer 2007.

The Site Columns is not required field, if the column is not fill in value, I expected it does not consume any spacing in display view of the page.

Example: arrange 5 columns vertically in page layout, if no value fill in, it consumed 5 empty rows.

Any workaround to hide away the empty space when no value fill into the column? Thank you in advanced.

share|improve this question

Use 2 edit mode panels. One with PageDisplayMode set to edit and the other to display. In the display mode, wrap your field with a div and give it an Id. Check with jQuery if empty like following:

$.trim($('#div_id').text()) == ""

then hide the div if so.

Or, if you don't like hiding with JS. place a visual webpart in the display mode of the EditModePanel, and through the object model get the values of the fields and send to the client only the HTML that contains data in whatever format you like.

share|improve this answer
Hi Mohammed Shokry, thanks for your reply, from your solution, when the field is empty, there is a default '  ' (with spacing after  ) value added automatically by SharePoint, just why need to trim away the white space and then hide the div. Is there any better solution rather than hide? – sams5817 Mar 5 '12 at 8:07
Let say I have <tr><td id="A"></td><td id="B"></td></tr>, when I check ID=A is empty, this may caused column with id=B align to the left – sams5817 Mar 5 '12 at 8:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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