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...

Thursday, 12 January 2012

How to add a Google Map to a SharePoint Server 2010 page

This is an incredibly useful tool, especially for those of you in the real estate industry. Here’s the basic procedure:
  • Define the map coordinates at the online map provider’s site
  • Copy the code for an embeddable version of the map
  • Paste the code into the HTML view of a Content Editor Web Part
How to add a Google Map to a SharePoint Server 2010 page
First, we need to grab the map.
  1. To start the process, open Google Maps.
  2. In the Text Box, enter the street address you plan on displaying.
  3. Click on the Link button above the map on the right.
  4. Click on the Customize and preview embedded map link located on the bottom.
  5. A second Google Maps window will now open. This window will provide you with some options for customizing the map view.
  6. Select the appropriate or custom map size you wish to display on your Web page.
  7. Copy the HTML map link code contained in Section 3 at the bottom of the page.
Alright, we’ve got it. Now, let’s open up SharePoint.
  1. Open SharePoint.
  2. Select the page in your site where you will be placing the map.
  3. From the Site Actions drop down menu, select Edit Page.
  4. With the SharePoint page open for editing, place the cursor where you want to add a Content Editor Web Part.
  5. In the Editing Tools group on the ribbon, click the Insert tab.
  6. Click the Web  Part.
  7. Click the Media and Content category, and then click Content Editor.
  8. Click Add.
  9. In the Content Editor Web Part, click Click here to add new content.
  10. In the Format Text tab of the ribbon, click HTML, and then click Edit HTML Source.
  11. In the HTML Source window, paste the cofe for the embeddable map, and then click OK.
  12. On the Page tab on the ribbon, click Save & Close.
That’s it! Now your business can be found both on and off the Web!

Monday, 9 January 2012

SharePoint JavaScript – Page Load Add function: Page Redirect

<script language="javascript">  
    _spBodyOnLoadFunctionNames.push("Redirect");  
   
    function Redirect()
   {
    window.location="your page name";
    }  
</script>