Monday, July 20, 2009

Hiding the Search Box When Printing

* Open the master page in SharePoint Designer
* Add the following style either to a CSS file included in the master page or as a style within the master page itself:

@media print{
.HideForPrinting
{
display:none;
}
}

* Locate the delegate control used to display the search box and add the code shown in italics:

<asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server”>
<span class=”HideForPrinting”>
<SharePoint:DelegateControl runat=”server” ControlId=”SmallSearchInputBox”/>
</span>
</asp:ContentPlaceHolder>

This defines a span that uses the style HideForPriting, the content of which will be hidden when the page is printed.

Change size of Rich Text Editing Control

When using the rich text column type in SharePoint lists the edit control has a fixed width of 384 pixels. This is often too small for easy editing.

If you need to change the width for a single form, open the form in SharePoint Designer and add a style defining ms-rtelong at the top of the content place holder in which the form is displayed with new dimensions, e.g.


<asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

<style type=”text/css”>
.ms-rtelong {
width:700px;
height:600px;
}
</style>

Tuesday, July 14, 2009

How to access inetpub root folder using programatically in sharepoint

Here i have mentioned how to access inetpub root folder using object model.

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

string filename = web.Site.WebApplication.IisSettings[SPUrlZone.Default].Path.FullName.ToString() + @"\_app_bin\layouts.sitemap";

it will give filename like "C:\Inetpub\wwwroot\wss\VirtualDirectories\5858\_app_bin\layouts.sitemap"

Tuesday, July 7, 2009

Call Javascript on Page Load in Sharepoint Application Page

http://blogs.msdn.com/sharepoint/archive/2007/06/21/using-javascript-to-manipulate-a-list-form-field.aspx

Customize Edit Page and Redirect page after update using java script

1. In Sharepoint Designer take your EditForm.aspx and copy it.
2. Rename it
3. Open this new form and click on the PlaceHolderMain (leave your ListFormWebPart on the page)
4. In the ListFormWebPart scroll down the properties in the xml which describes the webpart and change to false. For some reason the form will not work unless you leave the original on the page.
4. Click on Insert->Sharepoint Controls->Custom List Form
5. Choose the appropriate List and select Edit Form
6. Sharepoint generates the form for you.

To customize the save button, find the following control on the page Sharepoint:SaveButton

1. Delete the SaveButton
2. Add

input type="button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={Thanks.aspx}')}"

instead
3. This button allows the form to be saved and redirects to back to that page.

Friday, July 3, 2009

Delete Title Column in custom list sharepoint

Title column in custom list could be confusing in sharepoint. When you create any new custom list, Tital column is default column in list. You can't delete it but rename column name.

There is no way to Hide or Delete “Title” Column from List Settings User Interface. You can hide it by deselecting this column in your View but then you cannot edit the item as you wouldn’t have any Column linked to edit menu.

he only way to hide the “Title” Column is by writing a Custom List Definition, remember every Custom List MUST have this column as this is included in the Global ONET.xml (for Type “0″ List).

<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" ReadOnly="TRUE" Required="FALSE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title">
</Field>
<Field ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" Name="LinkTitle" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitle">
</Field>
<Field ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Name="LinkTitleNoMenu" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitleNoMenu">
</Field>