dotnetnukedotnetnuke-module

DNN MVC module Missing Edit option


My dnn mvc module is missing the Edit option. Normally you will get the pencil icon for editing see pic below

enter image description here

I'm using Chris Hammond template for this MVC module that I'm working on.

This is my Module.dnn file look like

<moduleControls>
    <moduleControl>
      <controlKey />
      <controlSrc>Abc.Controllers/Home/Index.mvc</controlSrc>
      <supportsPartialRendering>False</supportsPartialRendering>
      <controlTitle />
      <controlType>View</controlType>
      <iconFile />
      <helpUrl />
      <viewOrder>0</viewOrder>
    </moduleControl>
    <moduleControl>
      <controlKey>Edit</controlKey>
      <controlSrc>Abc.Controllers/Home/Edit.mvc</controlSrc>
      <supportsPartialRendering>False</supportsPartialRendering>
      <controlTitle>Edit Content</controlTitle>
      <controlType>Edit</controlType>
      <iconFile />
      <helpUrl />
      <viewOrder>0</viewOrder>
      <supportsPopUps>False</supportsPopUps>
    </moduleControl>
    <moduleControl>
      <controlKey>Settings</controlKey>
      <controlSrc>Abc.Controllers/Settings/Settings.mvc</controlSrc>
      <supportsPartialRendering>False</supportsPartialRendering>
      <controlTitle>FishProNews Settings</controlTitle>
      <controlType>Edit</controlType>
      <iconFile />
      <helpUrl />
      <viewOrder>0</viewOrder>
    </moduleControl>
  </moduleControls>
</moduleDefinition>

I have a Home Controller that point to Index and Edit but since I'm missing the Edit (pencil icon) I'm not able to test the Edit function.

Does anyone know hot to get the Edit (pencil icon) option?


Solution

  • Jack,

    The Edit icon is not a missing option. The pencil opens the ModuleAction menu that must be implemented by the module developer. Chris Hammond's template should have a decorator on your default module view's (Home) Index action.

    [ModuleAction(ControlKey = "Edit", TitleKey = "AddItem")]
    public ActionResult Index()
    {
        // Return the view and model
    }
    

    The ModuleAction decorator will add an item to the "pencil" module action menu. The ControlKey refers to the name of the action you want to call in your manifest file; ie: "Edit" which should have a Edit.cshtml and Edit action method in your Home controller. The TitleKey is the resource string for the menu. In your App_LocalResources/Home.resx you can add a resource string "AddItem.Text" with the value "Add New Item", for example.

    You should see something like this:

    enter image description here

    To see a working example, refer to my RestaurantMenuMVC example project.