Monday 26 March 2012

How to add Meta Data in a SharePoint Page



In the page search the below tag:

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">

Add the following line just below the above tag:

<title title="Your page title" />
<meta name="description" content="Your metadata description" />
<meta name="keywords" content="Your metadata keywords" />


Its over......Happy Coding :)
 

Thursday 22 March 2012

Adding CSS to ShaePoint Page or Custom Code Page

After a battle i found the solution "How to use CSS class inside a custom webpart page".

So to achieve this goal please follow the bellow steps,

1. Open the Solution File in Visual Studio (Webpart Page)
2. Do the changes in ChildControl Method

protected override void CreateChildControls()
        {
            Control control = Page.LoadControl(_ascxPath);
            Controls.Add(control);
            CssRegistration.Register("/Style%20Library/coreV5.css");
                      
        }
3. If you are creating a runtime table then use as below. In my case i have used this way:
writer.Write("<tr><td><table width='100%' border='0' cellSpacing='0' cellPadding='0'><tr class='ms-WPHeader'><td align='left' class='ms-wpTdSpace'></td><td class='ms-WPHeaderTd'><h3 class='ms-standardheader ms-WPTitle' style='text-align:justify;'><nobr><span>" + productCategory + " </span></nobr></h3></td><td align='right' class='ms-WPHeaderTdMenu'></td><td class='ms-WPHeaderTdSelection'></td><td align='left' class='ms-wpTdSpace'></td></tr></table></td></tr>");

Sunday 18 March 2012

Error: It may have been deleted or renamed by another user

Problem arises when you use ID as query string parameter.Ex: http:xyz:9000/Pages/EditItem.aspx?ID=21.

When we access this in application some times it starts showing up issue that Item doesn’t exists or being deleted by an other user.

Resolution for this issue is not to use ID in query string parameter. And any other key instead of “ID” will start working properly with out showing the above said issue.

Ex: http:xyz:9000/Pages/EditItem.aspx?ItemID=21 will not cause any issues.

How To Create A Custom Search Page in SharePoint 2010 Publishing Sites


There are a few reasons you may want to do this; complete control over search page, want to keep the search box where it is, anonymous access to search results, etc.
Create a search page
  1. Create a new site page called Search (search.aspx) in your Pages library
  2. In the ribbon click on Editing Tools > Insert > Web Part
  3. Under Categories, click on Search
  4. Under Web Parts, click on Search Core Results
  5. Click on Add
  6. Publish and Approve page if necessary
Enable your new search page
  1. Site Actions > site settings
  2. Site Collection Administration > Search Settings
  3. Search settings page
    1. Site collection search center: Do not use custom scopes
    2. Site collection search results page: type in the new page path (ie. /pages/search.aspx)
    3. Click on ok
You are done.... :) Happy Coding...