Created by SharePoint: ChangeContentType

Source: Internet
Author: User

Recently, I checked the SharePoint control and saw ChangeContentType. After decompiling the code, I found that after loading the content type, I bound a Js event to switch the content type.

List. Attributes ["onchange"] = "javascript: ChangeContentType (\" "+ list. ClientID +" \ "); return false ;";

I saw the URL of the pop-up form when creating a project through the content type (Ribbon:

/NewForm. aspx? ContentTypeId = 0x010200233000740CD5BAC93E134B911210D869427735 & IsDlg = 1

However, when we click below the list to add a new project, it is a different URL with no ContentTypeId. Of course, the pop-up is also the project corresponding to the default content type.

This leads to an idea:

If there are two views and the new projects required by the view are different.

We can use the following in a custom list:

Document. location. href = "NewForm. aspx? IsDlg = 1 & ContentTypeId = 0x010200508976737abb4f9da0b9a4c0d3a1386d "; to switch the open content type.

In this way, in different views of a list, we can directly click Add new project to add different content type projects without having to use Ribbon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.