Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.