Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Wednesday, 10 October 2012

Sample Page Layout .aspx file code


<%@ Page language="C#"   Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
 <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
  <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
   <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<asp:Content ContentPlaceholderID="PlaceHolderAdditionalPageHead" runat="server">
<SharePointWebControls:UIVersionedContent ID="UIVersionedContent1" UIVersion="3" runat="server">
<ContentTemplate>
<style type="text/css">
Div.ms-titleareaframe {
height: 100%;
}
.ms-pagetitleareaframe table {
background: none;
}

</style>

</ContentTemplate>
</SharePointWebControls:UIVersionedContent>
<SharePointWebControls:UIVersionedContent ID="UIVersionedContent2" UIVersion="4" runat="server">
<ContentTemplate>
<SharePointWebControls:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/page-layouts-21.css %>" runat="server"/>

<PublishingWebControls:EditModePanel ID="EditModePanel1" runat="server">
<!-- Styles for edit mode only-->
<SharePointWebControls:CssRegistration ID="CssRegistration1" name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/edit-mode-21.css %>"
After="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/page-layouts-21.css %>" runat="server"/>
</PublishingWebControls:EditModePanel>
</ContentTemplate>
</SharePointWebControls:UIVersionedContent>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
<SharePointWebControls:UIVersionedContent ID="UIVersionedContent3" UIVersion="3" runat="server">
<ContentTemplate>
<SharePointWebControls:ListProperty Property="Title" runat="server"/> - <SharePointWebControls:ListItemProperty Property="BaseName" MaxLength=40 runat="server"/>
</ContentTemplate>
</SharePointWebControls:UIVersionedContent>
<SharePointWebControls:UIVersionedContent ID="UIVersionedContent4" UIVersion="4" runat="server">
<ContentTemplate>
<SharePointWebControls:ListProperty Property="Title" runat="server"/> - <SharePointWebControls:FieldValue FieldName="Title" runat="server"/>
</ContentTemplate>
</SharePointWebControls:UIVersionedContent>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
<SharePointWebControls:VersionedPlaceHolder ID="VersionedPlaceHolder1" UIVersion="3" runat="server">
<ContentTemplate>
<WebPartPages:WebPartZone runat="server" Title="loc:TitleBar" ID="TitleBar" AllowLayoutChange="false" AllowPersonalization="false"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
</ContentTemplate>
</SharePointWebControls:VersionedPlaceHolder>
<SharePointWebControls:UIVersionedContent ID="UIVersionedContent5" UIVersion="4" runat="server">
<ContentTemplate>
<SharePointWebControls:FieldValue FieldName="Title" runat="server" />
</ContentTemplate>
</SharePointWebControls:UIVersionedContent>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server">
<SharePointWebControls:VersionedPlaceHolder ID="VersionedPlaceHolder2" UIVersion="3" runat="server"> <ContentTemplate> <asp:SiteMapPath ID="siteMapPath" runat="server" SiteMapProvider="CurrentNavigation" RenderCurrentNodeAsLink="false" SkipLinkText="" CurrentNodeStyle-CssClass="current" NodeStyle-CssClass="ms-sitemapdirectional"/> </ContentTemplate> </SharePointWebControls:VersionedPlaceHolder>
<SharePointWebControls:UIVersionedContent ID="UIVersionedContent6" UIVersion="4" runat="server"> <ContentTemplate> <SharePointWebControls:ListSiteMapPath runat="server" SiteMapProviders="CurrentNavigation" RenderCurrentNodeAsLink="false" PathSeparator="" CssClass="s4-breadcrumb" NodeStyle-CssClass="s4-breadcrumbNode" CurrentNodeStyle-CssClass="s4-breadcrumbCurrentNode" RootNodeStyle-CssClass="s4-breadcrumbRootNode" NodeImageOffsetX=0 NodeImageOffsetY=353 NodeImageWidth=16 NodeImageHeight=16 NodeImageUrl="/_layouts/images/fgimg.png" HideInteriorRootNodes="true" SkipLinkText="" /> </ContentTemplate> </SharePointWebControls:UIVersionedContent> </asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
<SharePointWebControls:ProjectProperty ID="ProjectProperty1" Property="Description" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderBodyRightMargin" runat="server">
<div height=100% class="ms-pagemargin"><IMG SRC="/_layouts/images/blank.gif" width=10 height=1 alt=""></div>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
  <!--- End Menu -->
   
            <div style="width:500px">
                <WebPartPages:WebPartZone runat="server" Title="TitleZone" ID="TitleZone" ><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>      
            </div>
     
    <!--- End Banner -->
 
     
<WebPartPages:WebPartZone runat="server" Title="RightZone" ID="RightZone"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
             
     
        <!--- End Cnt -->

</asp:Content>

Element File content


This element file is used to create a page layout with default webpart in the wepart layout...




?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <Module Name="CustomLayouts" List="116"  Url="_catalogs/masterpage">

    <File Path="CustomLayouts\Blackintonfaq.aspx" Url="Blackintonfaq.aspx" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary">

      <!--<AllUsersWebPart WebPartZoneID="TitleZone" WebPartOrder="1">

        <![CDATA[

        <webParts>
        <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
          <metaData>
            <type name="BlackInTon.Title.Title, BlackInTon, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2754d9471101933f" />
            <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
          </metaData>
          <data>
            <properties>
              <property name="Title" type="string">Title</property>
              <property name="Description" type="string">My Visual WebPart</property>
              <property name="ChromeType" type="chrometype">None</property>
            </properties>
          </data>
        </webPart>
      </webParts>
      
      ]]>
       



    </File>
 </Module>

Change the webpart as your wish...

Friday, 27 July 2012

The request failed with HTTP status 417: Expectation failed when SharePoint calling .asmx web service

I tried to access a web method in a .asmx web service from SharePoint web service.
To add a web reference steps
  1. Add Service Reference
  2. Click Advance button in the window
  3. Click Add Web Reference in the next window
  4. Then paste the asmx path add give a reference name then click ok
After this I tried to call the web method but it gives the  The request failed with HTTP status 417 error  I tried with Google finally I found a link in Code Project
http://www.codeproject.com/Articles/94235/The-request-failed-with-HTTP-status-417-Expectatio

Steps to Resolve
  • We need to have this line of code before making any web requests:  
         System.Net.ServicePointManager.Expect100Continue = false
 
  • Add these lines to the application's configuration file (between <configuration> and </configuration>): 
     
    <system.net>
     <settings>
      <servicePointManager expect100Continue="false" />
     </settings>
    </system.net>
     
     
    Now Everything goes fine.
     
    Happy Coding :)  

Wednesday, 9 May 2012

How to Change the size of Default settings page and list page in SharePoint 2010 and change the body background color completely

Hi I was designed a master page and page layout for a branding site.  The master page having 950px width and aligned in the center.

But the problem is when I visit the default page of SharePoint like site setting, view all site content they all are remains in the same width. 

I wondered because I covered the content place holder by a div with 950px width.  But it is not applied so I decided to do a smart work.  Open the firefox and check the style with the help of firebug I found that a content table completely keep the default page there a style that take about the width and the color. 

.s4-ca {
    background: none repeat scroll 0 0 #fffff;
    margin-left: 155px;
    margin-right: 0;
    min-height: 324px;
}

I change the style as per my wish....

then paste it to my master page to override.

Now it is working....  

If you remove background color property at the time you can able to get the background color defined in the body style class..   But it is not looking fair......

Happy Coding:)

Hide the master page menu in the pop ups like 'check in' in SharePoint 2010

         Now am busy with the branding task.  We are working to develop a custom master page using v4.master in SharePoint 2010.   We almost finish the development but we face a problem that is when the user going to check in the page at the time a pop up comes with lightbox effect the our master page menu is displayed.

         That is not we expected.  So I am tried to resolve the problem in a smart way.  By using the developer tool in Mozilla Firefox I found the master page header and remaining items are hide out by dynamic div section that is asp panels. 

         Our menu is inside the default asp panel called pnlMenu  so I commented the panel but still it displayed then I check the header content's asp panel that is hide out while displaying the pop up.  

         Simply cut and paste my menu to there....

         Now it is working fine..... 

         Happy Coding :)

Thursday, 12 April 2012

Trying to use an SPWeb object that has been closed or disposed and is no longer valid

I tried to create website which is mostly deals with SharePoint list...   So I planed to minimize the resource usage by using the 'using' statement for the SPSite and SPWeb.

I create SPSite and SPWeb where I need. 

Finally I face the error

Trying to use an SPWeb object that has been closed or disposed and is no longer valid

 I check with the microsoft website

 http://social.technet.microsoft.com/Forums/en/sharepoint2010setup/thread/383931c6-3724-40ff-8ae8-7f26d6db1c92


They suggest don't dispose SPSite or SPWeb including SPContext.SPSite or SPContext.SPWeb also...

I remove the using statement and define the SPSite at the time on initialization by

SPSite MySite= new SPSite(SPContext.Current.WebUrl);

SPWeb MyWeb=null;

  and define the SPWeb in the constructor by 

 MyWeb=MySite.OpenWeb();

 Great now all working fine...

 Happy Coding :)