Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

SharePoint ChangeContentType DropDown

I have attached an application page to the custom document based content type as its edit form. That content type is being used in a document library which has more than one content type attached to it.

SharePoint form field controls render the respective fields correctly. Change content type control lists all the content types related to the lists in a dropdown as well. But when I change the selection, means when I select different content type, the form does not show the set of fields for the selected content type rather it stays as it is.

Code:

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApplicationPage1.aspx.cs" Inherits="DMS_POC.Layouts.DMS_POC.ApplicationPage1" DynamicMasterPageFile="~masterurl/default.master" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" src="../../../_controltemplates/15/ToolBar.ascx" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
            <table>
            <tr>
                <td>
                    <span id='part1'>
                        <SharePoint:InformationBar ID="InformationBar1" runat="server" />
                        <div id="listFormToolBarTop">
                            <wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbltop" RightButtonSeparator="&amp;#160;" runat="server">
                                <template_rightbuttons>
                                    <SharePoint:NextPageButton ID="NextPageButton1" runat="server"/>
                                    <SharePoint:SaveButton ID="SaveButton1" runat="server"/>
                                    <SharePoint:GoBackButton ID="GoBackButton1" runat="server"/>
                                </template_rightbuttons>
                            </wssuc:ToolBar>
                        </div>

                        <SharePoint:ItemValidationFailedMessage ID="ItemValidationFailedMessage1" runat="server" />
                        <table class="ms-formtable" style="margin-top: 8px;" border="0" cellpadding="0" cellspacing="0" width="100%">
                            <SharePoint:ChangeContentType ID="ChangeContentType1" runat="server" />
                            <SharePoint:FolderFormFields ID="FolderFormFields1" runat="server" />


                            <tr>
                                <td>
                                    <SharePoint:FieldLabel ID="lbl_ProposalNumber" runat="server" FieldName="ProposalNo" />
                                </td>
                                <td>
                                    <SharePoint:FormField ID="field_ProposalNumber" runat="server" FieldName="ProposalNo"
                                        ControlMode="Display" />
                                </td>
                            </tr>

                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>

                            <tr>
                                <td>
                                    <SharePoint:FieldLabel ID="lbl_CustName" runat="server" FieldName="CustomerName" />
                                </td>
                                <td>
                                    <SharePoint:FormField ID="field_CustName" runat="server" FieldName="CustomerName"
                                        ControlMode="Edit" />
                                </td>
                            </tr>

                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>

                            <tr>
                                <td>
                                    <SharePoint:FieldLabel ID="lbl_ProposalType" runat="server" FieldName="ProposalType" />
                                </td>
                                <td>
                                    <SharePoint:FormField ID="field_ProposalType" runat="server" FieldName="ProposalType"
                                        ControlMode="Edit" />
                                </td>
                            </tr>

                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>

                            <tr>
                                <td>
                                    <SharePoint:FieldLabel ID="lbl_RevertBy" runat="server" FieldName="RevertBy" />
                                </td>
                                <td>
                                    <SharePoint:FormField ID="field_RevertBy" runat="server" FieldName="RevertBy"
                                        ControlMode="Edit" />
                                </td>
                            </tr>

                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>

                            <tr>
                                <td style="vertical-align:top">
                                    <SharePoint:FieldLabel ID="lbl_Details" runat="server" FieldName="Details" />
                                </td>
                                <td style="vertical-align:top">
                                    <SharePoint:FormField ID="field_Details" runat="server" FieldName="Details"
                                        ControlMode="Edit" />
                                </td>
                            </tr>

                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>

                            <tr>
                                <td>
                                    <SharePoint:FieldLabel ID="lbl_SignRequired" runat="server" FieldName="DigitalSignatureRequired" />
                                </td>
                                <td>
                                    <SharePoint:FormField ID="field_SignRequired" runat="server" FieldName="DigitalSignatureRequired"
                                        ControlMode="Edit" />
                                </td>
                            </tr>

                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>

                            <tr>
                                <td>
                                    <SharePoint:FieldLabel ID="lbl_Amount" runat="server" FieldName="Amount" />
                                </td>
                                <td>
                                    <SharePoint:FormField ID="field_Amount" runat="server" FieldName="Amount"
                                        ControlMode="Edit" />
                                </td>
                            </tr>

                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>

                            <tr>
                                <td>
                                    <SharePoint:FieldLabel ID="lbl_Final" runat="server" FieldName="Final" />
                                </td>
                                <td>
                                    <SharePoint:FormField ID="field_Final" runat="server" FieldName="Final"
                                        ControlMode="Edit" />
                                </td>
                            </tr>

                            <SharePoint:ApprovalStatus ID="ApprovalStatus1" runat="server" />
                            <SharePoint:FormComponent ID="FormComponent1" TemplateName="AttachmentRows" ComponentRequiresPostback="false" runat="server" />
                        </table>
                        <table cellpadding="0" cellspacing="0" width="100%" style="padding-top: 7px">
                            <tr>
                                <td width="100%">
                                    <SharePoint:ItemHiddenVersion ID="ItemHiddenVersion1" runat="server" />
                                    <SharePoint:ParentInformationField ID="ParentInformationField1" runat="server" />
                                    <SharePoint:InitContentType ID="InitContentType1" runat="server" />
                                    <wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl" RightButtonSeparator="&amp;#160;" runat="server">
                                        <template_buttons>
                                    <SharePoint:CreatedModifiedInfo ID="CreatedModifiedInfo1" runat="server"/>
                                </template_buttons>
                                        <template_rightbuttons>
                                    <SharePoint:SaveButton ID="SaveButton2" runat="server"/>
                                    <SharePoint:GoBackButton ID="GoBackButton2" runat="server"/>
                                </template_rightbuttons>
                                    </wssuc:ToolBar>
                                </td>
                            </tr>
                        </table>
                    </span>
                </td>
                <td valign="top">
                    <SharePoint:DelegateControl ID="DelegateControl1" runat="server" ControlId="RelatedItemsPlaceHolder" />
                </td>
            </tr>
        </table>

</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Application Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
My Application Page
</asp:Content>
share|improve this question

1 Answer 1

If by "application page" you really mean a page deployed in _layouts folder, before anything else i would say it is not the recomanded approach (can't think of a way to integrate that) and this might be the reason why SharePoint is unable to detect it, as Form pages depend on special ListView web parts being present on the page which makes the "magic" of showing appropiate fields. If an issue is present, e.g. not properly configured, in most cases it defaults to regular form (DispForm.aspx, EditForm.aspx, etc.) - i recomand you read this to understand the innerworkings http://hristopavlov.wordpress.com/2009/02/17/understanding-sharepoint-list-forms/

If you wish to create a customized form, you can either use SharePoint Designer or Visual Studio (regularly via a Module custom forms could be deployed fairly easy), or InfoPath forms (not available for Document Libraries) - see here http://blogs.sharepointdam.com/jen/archive/2009/10/12/custom-list-forms-with-code-behind.aspx or http://blog.karstein-consulting.com/2011/01/24/walkthrough-create-custom-sharepoint-2010-list-form-for-deployment-in-a-visual-studio-2010-project-part-2/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.