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