Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Eric 35 posts 55 karma points
    Nov 22, 2010 @ 16:14
    Eric
    0

    remove some Document Type and Media Type from the DropDownList after Create

    Hi everybody,

    In the content or media tree, when you create a new node, a popup window allows you to choose the document/media type for the child among the allowed children. But when the context node is the tree, the dropdownlist shows the entire list of document type / media type. Is it possible to remove some of them trough the ApplicationBase ? How ? 

    I guess I have to work on event

    Media.New += new Media.NewEventHandler(Media_New);

    void Media_New(Media sender, umbraco.cms.businesslogic.NewEventArgs e)
       {

    if (sender.Level == -1)
            {
                // I can not figure out how to accees the listItem of the rendered DropDownList
            }

    }

    Check this screenshot (right-click > Create on the "Content" node): from these DocumentType, only 3 can be created right below "content", the remainings items are only children of other document types

    Can anyone help ? Thanks in advance.

  • Sean Mooney 131 posts 158 karma points c-trib
    Nov 22, 2010 @ 17:14
    Sean Mooney
    0

    I don't believe that you can remove items from the dropdown list using the Media.New event.

    However, using your existing code you could check the document type that is being created and return false if you do not want the user to create it.

    It's not the most elegant way but it would prevent the user from creating those documents.

Please Sign in or register to post replies

Write your reply to:

Draft