SharePoint Jquery Change Save Button Redirect URL New and Edit Form

I came across a situation when client wants to redirect different url after item is saved.

By using Jquery I am able to redirect to a different page after user had save all information from page.

Use below Jquery to change redirect URL of save button

$(document).ready(function() {

//Select Save btnSave
var btnSave = $(“input[id$=SaveItem]”);

//Remove Default Redirect Attribute of Save
btnSave.removeAttr(“onclick”);

btnSave.click(function() {

var elementName = $(this).attr(“name”);

var newPostbackUrl = “http://dell-pc:9999/_layouts/settings.aspx”;

if (!PreSaveItem()) return false;

WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, “”, true, “”, newPostbackUrl, false, true));
});
});

SharePoint Static Name vs Internal Name vs Display Name

During development of SharePoint Project code I found a field contains multiple name and i was confused for multiple names.

After doing some research I found detailed information about them

Display Name : A string that contains the display name. (Display Name also known as Title)
Internal Name: Gets the internal name that is used for the field.
Static Name: Gets or sets the internal name of the field.

Display Name is the name shown to the user. It can contain spaces in special characters. When display name is created, an Internal Name is derived from it by replacing spaces and special characters with _0xXXXX_ where XXXX is a Unicode hexadecimal representation of the character being replaced. For example: My Column Name would be converted to My_0x0020_Column_0x0020_Name. Once the Internal Name is set it cannot be changed even if the Display Name from which it is derived is changed.

In detail

Display Name: A string that contains the display name. Display name is used to derive Internal and Static Names, however once those are set, changing Display Name will not affect Internal and Static Names.

Internal Name: Gets the internal name that is used for the field. It is a unique non-changeable string that identifies a column in the list. If multiple columns in the list have the same name, SharePoint will add 0,1,2,etc at the end of each new column added to make them unique.

Static Name: Gets or sets the internal name of the field. This is the internal name of the fields without any digits added to it. It is not guaranteed to be unique within a list.

SharePoint Feature and Scope of Feature

SharePoint Feature  is part of Packaging and Deployment in SharePoint 2010. Depending on feature scope we can activate and deactivate functionality of solution on Site collection or web level.

Below link gives more detailed information about feature and its scope.

http://www.pritambaldota.com/index.php/understanding-features-and-feature-scope-in-sharepoint-2010/

 

SharePoint Difference Between SPWeb.AvailableContentTypes Vs SPWeb.ContentTypes

We are using SPWeb.AvailableContentTypes and SPWeb.ContentTypes to get content types from SharePoint.

I was facing an issue regarding content types that some content types are not available from code because I was using AvailableContentTypes from sub site and after some research I found difference between SPWeb.AvailableContentTypes and SPWeb.ContentTypes
SPWeb.ContentTypes :
The ContentTypes property returns only the content types that exist on the current Web site, not all content types in the current scope.

SPWeb.AvailableContentTypes:
Use the AvailableContentTypes property to return all content types in the current scope, including those of any parent Web sites.
static void GetContentTypes()
{
using (SPSite oSite = new SPSite(@”http://dell-pc:9999/”))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
//SPContentTypeCollection ctypecoll = oWeb.ContentTypes; // USING CONTENT TYPES
SPContentTypeCollection ctypecoll = oWeb.AvailableContentTypes; // USING AVAILABLE CONTENT TYPES
foreach (SPContentType type in ctypecoll)
{
Console.WriteLine(“ID: ” + type.Id + ” ; Name: ” + type.Name);
}
}
}
}

SharePoint 2013 How to Create Site Column , Content Type and List programmatically

Every SharePoint Development Project need to create Site Columns , Content Type , List from code which is used to deploy it on any server.

Please check below link to create Site Columns , Content Types and List programmatically

http://www.sharepoint-journey.com/sharepoint-list-content-types-and-site-columns.html

Visual Studio How to Create a blank Project Solution

During development of a new project I came across a situation where I need to create blank solution of Project.

Once a blank solution is created I can add multiple solution in it

To Create Blank Solution from Visual Studio follow steps:

  1. On the File menu, select New and then click Project.
  2. In the Project types pane, select Other Project Types and then select Visual Studio Solutions.
  3. In the Templates pane, select Blank Solution.
  4. Enter a name for the project.
  5. To change the location of the solution directory, choose Browse and specify a new location.
  6. Select Add to Source Control if you want to add the solution to a source control database or repository.
  7. Click OK.

For Project and more details about this please check Microsoft link

http://msdn.microsoft.com/en-us/library/zfzh36t7%28VS.80%29.aspx