Friday, April 16, 2010

Default Web Part

When we create any list or document library, it gets created with few default aspx pages like AllItems.aspx, NewForm.aspx, EditForm.aspx and DispForm.aspx.

I generally preferred to customize these forms or by creating new views.

When we do it, the default web part in these pages is the biggest blocker to perform our work.

If we delete the default web part, god knows or Microsoft knows about the problems you will run into. So, NEVER EVER delete default web part from above pages. Better keep this web part hidden and closed. You can do it in the designer by right-clicking on the web part and go to web part properties. For NewForm.aspx and other aspx pages, we will see Edit Page link under Site Settings is disabled. Also, you are not allowed to user designer to remove/close/hide the web part when the application is in DEV/TEST/Production servers.

So, what is the alternative?

For the above pages, append "contents=1" at the end of the url.

Note: If the url has no parameters, then add "?contents=1". If the url has # at the end, then delete the character "#" and then add "&contents=1".

I ran into this issue during my deployment of sharepoint application.

Thursday, March 11, 2010

How to hide search control on default.master

Summary:

This post describes how to hide the search control on default.master. The steps described below are applicable for other master pages, as well.

Resolution:
Open SharePoint Designer 2007. Go to File | Open Site and connect to SharePoint site.

Expand out _catalogs -> masterpage -> open default.master. Check out file, if necessary.

In Code View, search for "PlaceHolderSearchArea". After id="PlaceHolderSearchArea", add the following property: Visible="false". In all, the code should look something like:


<asp:ContentPlaceHolder id="PlaceHolderSearchArea" Visible="false" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>


Save master page, check in (if necessary), and publish major version.

NOTE: To reverse the changes, simply set Visible="true" on the placeholder.

I decided to write this post as we've seen several support cases with questions on how to hide / manipulate the search control on master pages. This post just covers hiding the search box. There are multiple ways to hide the search control, to be sure, including using CSS (ex: "display:none;").

NOTE:
You can see the original post

Wednesday, January 20, 2010

Newline breaks in XSLT (SharePoint DataForm Web Part)

Scenario: In a custom sharepoint .aspx page, I placed a dataform web part for display page of an item. The item has a column called "Contents". This is a field contains data as paragraphs. When I created a new item, entered data into "Contents" field with spaces between paragraphs. I want to see the data as I entered earlier in the EditForm.aspx & DisplayForm.aspx pages.

When I used , the contents field showed the data without newlines between the paragraphs.

Example:

I entered the data in NewForm.aspx as below:
"
aasdflasdf asdf asdf asdf asdf asdf.

234234aefase5asfgasdfa
asdfasdf
asdf
asdf
a

asdfasdfas"

Note: You can see spaces between the above statements. When I tried to display above content in DisplayForm.aspx, it showed without spaces & special characters as below:

"aasdflasdf asdf asdf asdf asdf asdf.234234aefase5asfgasdfaasdfasdfasdfasdfaasdfasdfas"

Solution:

Add following attributes to xsl:value-of tag:
a. select="ddwrt:AutoNewLine(string(@Contents))"
b. disable-output-escaping="yes"

Note:
1. You can find information about ddwrt:AutoNewLine at Microsoft Site.
2. disable-output-escaping="yes" attribute is meant for showing all special characters like quotes and so on.

Friday, January 15, 2010

Cannot add attachment to custom list form in SharePoint 2007

The problem is that whenever you customize a list form—for example, remove assignment and status fields from a form to submit new issues—you break the ability for the user to add attachments to the list item from that form. In most cases, we got an "Error on Page" at in the status bar with the following message shown in the Error Details:

Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.

We finally have a resolution now, although it does take code modifications to each customized list form. See the complete details here:

http://support.microsoft.com/kb/953271

**Pay careful attention to the code. For new item forms, there are SEVERAL changes required to the code and the changes must be made in multiple places.

Source: https://staceybailey.securespsites.com/blog/Lists/Posts/Post.aspx?ID=13