Page layout share point

Click on New Page layout option in below screen.

 


 
 

Designer Option to create page layout clipping taken: 10/5/2014 1:31 PM

 
 

 
 


 
 

Screen popup on clicking Page layout: 10/5/2014 1:33 PM


Once creating the page layouts in this option we can able to use It in our pages. It will appear in Page creation options.

 
 

The Page layouts structure will be as below,

 
 


 
 

Page layouts content page holder taken: 10/5/2014 1:37 PM

 
 


 
 

Editing Page layout Properties : 10/5/2014 2:54 PM

 
 

Only on editing the page layout properties in the option “Manage all file properties in the browser” the page can be changed from Design file option to Page layout option without any inline codes added. This allows to reuse the page in different page layouts.

 
 

 In embedding the page layout in Solution we can use the below code in Elements.xml.

 
 

 


 
 

How to package Page Layouts/Master Pages in VS in SharePoint 2013? – SharePoint Stack Exchange

http://sharepoint.stackexchange.com/questions/62407/how-to-package-page-layouts-master-pages-in-vs-in-sharepoint-2013

Package Page layouts in VS 2013 taken: 10/5/2014 3:55 PM

 
 

Reference URL for Page layouts:

 
 

http://www.sharepointnutsandbolts.com/2007/04/deploying-master-pages-and-page-layouts.html

 
 

 
 

In order to appear that page layouts option in Screen, Checkout, Check in and Publish a major version.

 
 

Cascading dropdown in List content type using SPServices

$(document).ready(function () {

$().SPServices.SPCascadeDropdowns({

relationshipWebURL: “/”,

relationshipList: “Dealer”,

relationshipListParentColumn: “DealerCountryLookup”,

relationshipListChildColumn: “Title”,

relationshipListSortColumn: “”,

parentColumn: “Country”,

childColumn: “Dealer”,

debug: true

 
 

});

});

 
 

 
 

The reference for Cascading dropdown for SPServices is as below,

 
 

http://spservices.codeplex.com/wikipage?title=$().SPServices.SPCascadeDropdowns&referringTitle=Documentation

http://sympmarc.com/2010/03/23/hello-world-test-with-spservices-and-sharepoint-2010-spcascadedropdowns/

Deleting the Contents on deactivating the feature

17 October 2014

12:30

Delete the .webpart file on feature deactivation

The web part files will be stored in List template type SPListTemplateType.WebPartCatalog.

We can delete it by taking the web part name from list.

You can use the below code in feature deactivation to delete the .webpart file

SPSite site = properties.Feature.Parent as SPSite;

SPWeb web = site.RootWeb;

int itemToDelete = 0;

SPList list = site.GetCatalog(SPListTemplateType.WebPartCatalog);

foreach (SPListItem item in list.Items)

{

if (item[“Web Part”].ToString().ToLower() == (“Sample.webpart”).ToLower())

{

itemToDelete = item.ID;

if (itemToDelete > 0)

{

SPListItem listitem = list.GetItemById(itemToDelete);

listitem.Delete();

}

list.Update();

}

}

Deleting the files in Module on feature deactivation

private static void DeleteFilesinStyleLibrary(SPWeb curWeb)

{

List<string> lStyleLibrarySubDirs = new List<string>();

//add all style library sub directories.

lStyleLibrarySubDirs.Add(“Images”);//Images folder in style library or the folder in module

if (lStyleLibrarySubDirs.Count > 0)

{

//go through each list

for (int i = 0; i < curWeb.Lists.Count; i++)

{

if (curWeb.Lists[i].RootFolder.Name.Equals(“Style Library”))

{

SPDocumentLibrary styleLib = (SPDocumentLibrary)curWeb.Lists[i];

foreach (String sSubDir in lStyleLibrarySubDirs)

{

foreach (SPListItem subFolder in styleLib.Folders)

{

//if themable dir

if (subFolder.Name.Equals(sSubDir))

{

if (subFolder.Folder.ParentFolder.Name.Equals(“Style Library”))

{

SPFileCollection collFiles = subFolder.Folder.Files;

for (int intIndex = collFiles.Count – 1; intIndex > -1; intIndex–)

{

string strDelUrl = collFiles[intIndex].Url;

collFiles.Delete(strDelUrl);

}

}

}

}

}

}

}

}

}

Reference:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfilecollection.delete

http://blog.pixelmill.com/1123/housekeeping-deactivation-removing-what-you-added/

Delete the MasterPage file on feature deactivation

private static void DeleteMasterPageCss(SPWeb curWeb)

{

List<string> lFilestoDelete = new List<string>();

lFilestoDelete.Add(curWeb.Url + “/_catalogs/masterpage/Sample.master”);

lFilestoDelete.Add(curWeb.Url + “/Style Library/Sample.css”);

foreach (String fileUrl in lFilestoDelete)

{

SPFile file = curWeb.GetFile(fileUrl);

if (file != null)

{

file.Delete();

curWeb.Update();

}

}

}