Custom Module - missing button "New Element"

Stefan Sturm asked on March 8, 2016 10:17

Hello,

i've created the custom module "Company overview" exactly as described in the documentation two times to be shure i did't made any misstakes but it alwasy ends up in the same situation.

After creation i'm not able to create a new DB entry simply becaus i'm missing the "New Element" button in the application.

This is not the first time i had such a problem - the same problem exists on the product version application but this doesnt matter at the moment.

I'm working with Kentico v8.1.9 and currently i have no idea what i can do to fix this.

Update:

For testing reasons I manually created an interface for custom modules and from my point of view it looks like the header action is missing.

Please help

Stefan

Recent Answers


Trevor Fayas answered on March 8, 2016 15:35

Can you post some of your code so we can take a look?

0 votesVote for this answer Mark as a Correct answer

Stefan Sturm answered on March 8, 2016 15:50 (last edited on March 8, 2016 15:50)

Hey Trevor,

there is no code. I just added the custom interface to see what happens. Just for testing purposes and their i have the "New office" button.

 // Creates and adds the "New office" button as a header action
        HeaderAction newOffice = new HeaderAction
            {
                Text = GetString("New office"),
                RedirectUrl = "~/CMSModules/CompanyOverview/NewOffice.aspx"
            };

But again the custom interface was only for testing reasons created. When i follow the documentation as linked above i end up in the situation with the missing button "New element".

So when i whant to do the following:

Office editing element

  1. Select Company overview in the UI element tree.
  2. Click New element ().
  3. Set the following properties for the element:

    • Display name: Edit office
    • Code name: EditOffice (Important: The code name of elements for editing objects under listings must always start with the Edit keyword)
    • Module: Company overview
    • Page template: New / Edit object
  4. Click Save

i cant do it ^^

The only code i've wrote (pasted) was the default.xml

<?xml version="1.0" encoding="utf-8" ?>
<grid>
    <actions>
        <action name="edit" caption="$General.Edit$" fonticonclass="icon-edit" fonticonstyle="allow" />
        <action name="#delete" caption="$General.Delete$" fonticonclass="icon-bin" fonticonstyle="critical" confirmation="$General.ConfirmDelete$" />
    </actions>
    <columns>
        <column source="OfficeDisplayName" caption="Office name" wrap="false" localize="true">
            <filter type="text" size="200" />
        </column>
        <column source="OfficeAddress" caption="Address" width="100%" />    
    </columns>
    <options>
        <key name="DisplayFilter" value="true" />
    </options>
</grid>
0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on March 8, 2016 18:39

The HeaderAction is a control that's on one of Kentico's master pages for it's internal systems (ex ~/CMSMasterPages/UI/SimplePage.master). Now i think i know where you're getting at. I've run into a similar issue.

The Inherited class often has reference to the HeaderActions object, but you need the control to render it (and possibly overwriting logic)

The SimplePage.master's has this control, and in the back an override. You will probably have to do the same or inherit the SimplePage.master

<cms:ObjectEditPanel ID="actionsElem" runat="server" IsLiveSite="false" />

/// <summary>
/// HeaderActions control.
/// </summary>
public override HeaderActions HeaderActions
{
    get
    {
        if (base.HeaderActions != null)
        {
            return base.HeaderActions;
        }
        return actionsElem.HeaderActions;
    }
}
0 votesVote for this answer Mark as a Correct answer

Antony V answered on June 7, 2017 05:06

Ran into the same issue. Make sure that the code name of the admin UI page you use for adding new elements begins with "New". That fixed it for me.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on June 8, 2017 15:36

Thanks Antony, i always use the "New ____" and "Edit ____" with the sub elements, i guess the New and Edit is the magical keyword that makes it work (always wondered that)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.