none
Ribbon greyed out when using custom forms for list

    Question

  • HI

    I have created custom list schema.The schema is working fine with default forms.After that I added custom form and a custom webpart instead of listview webpart by using following schema

      <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" Template ="MyCustomForm">
            <WebParts>
            <AllUsersWebPart WebPartZoneID="Main" WebPartOrder="1">
              <![CDATA[              
            <?xml version="1.0" encoding="utf-8"?>
            <webParts>
              <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                <metaData>
                  <type name="FCPA.WebParts.AddQuestionnaire.AddQuestionnaire, FCPA.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=883a6c3144ed2d36" />
                  <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
                </metaData>
                <data>
                  <properties>
                    <property name="Title" type="string">FCPA Response</property>
                  </properties>
                </data>
              </webPart>
            </webParts>
            ]]>
            </AllUsersWebPart>
            </WebParts>
          </Form>
          <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" Template ="MyCustomForm">
            <WebParts>
              <AllUsersWebPart WebPartZoneID="Main" WebPartOrder="1">
                <![CDATA[              
            <?xml version="1.0" encoding="utf-8"?>
            <webParts>
              <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                <metaData>
                  <type name="FCPA.WebParts.AddQuestionnaire.AddQuestionnaire, FCPA.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=883a6c3144ed2d36" />
                  <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
                </metaData>
                <data>
                  <properties>
                    <property name="Title" type="string">FCPA Response</property>
                  </properties>
                </data>
              </webPart>
            </webParts>
            ]]>
              </AllUsersWebPart>
              
            </WebParts>
          </Form>
          <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" Template ="MyCustomForm">
            <WebParts>
              <AllUsersWebPart WebPartZoneID="Main" WebPartOrder="1">
                <![CDATA[              
            <?xml version="1.0" encoding="utf-8"?>
            <webParts>
              <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                <metaData>
                  <type name="FCPA.WebParts.AddQuestionnaire.AddQuestionnaire, FCPA.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=883a6c3144ed2d36" />
                  <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
                </metaData>
                <data>
                  <properties>
                    <property name="Title" type="string">FCPA Response</property>
                  </properties>
                </data>
              </webPart>
            </webParts>
            ]]>
              </AllUsersWebPart>
              
              </WebParts>
    
          </Form>
        </Forms>

    This schema created the custom form and adds the webpart successfully.Now the issue is that the ribbon gets greyed out.I tried to activate it but nothing happens.I have even written the following code "onprerender" also to enable ribbon but nothing happens.

      base.OnPreRender(e);
                SPRibbon current = Microsoft.SharePoint.WebControls.SPRibbon.GetCurrent(this.Page);
                current.CommandUIVisible = true;
                current.EnableVisibilityContext("WSSNonSpecialFormVisibilityContext");
                current.Minimized = false;
                current.MakeTabAvailable("Ribbon.ListForm.Display", "WSSNonSpecialFormVisibilityContext");
                current.InitialTabId = "Ribbon.ListForm.Display";

    How can I enable the greyed out ribbon.

    If that is not feasible then How can I remove the tabs and add the same again.


    Wednesday, August 01, 2012 10:13 AM

All replies