Search code examples
dotnetnuke

How to display the native DNN popup in a custom controller action?


I have created a DNN module using the MVC template in Visual Studio. The template creates an ItemController with "Delete", "Edit" ad "Index" actions. The "Edit" action, in particular, displays a popup for editing the model's properties.

I managed to create another controller with Index and Edit actions, and the Edit actions displays the popup like in ItemController.

Then I tried to create another action (let's say "Add"), and I would like it to use the popup display. I've tried to add a new module action in the .dnn file with the element <supportsPopUps>True</supportsPopUps>, but it doesn't work.

How can I do it?


Solution

  • I found out that in the template example, the link opening up the popup in the .cshtml file:

    <a href="@Url.Action("Edit", "Item", new {ctl = "Edit", itemId = item.ItemId})">@Dnn.LocalizeString("EditItem")</a>
    

    specifies the route value ctl = "Edit". This parameter seems to control the popup display, though I don't understand how it works.