This is a migrated thread and some comments may be shown as answers.

MVC - how to open window in MVC project with areas

3 Answers 217 Views
Window
This is a migrated thread and some comments may be shown as answers.
Gaetano
Top achievements
Rank 1
Gaetano asked on 12 Feb 2013, 12:29 PM
Hi,
my code doesn't work, it do not find a controller action because is located in a specific area of my MVC project.
Can I specify in url parameter what is the area name from which call the action method?

$("<div id = '10'/>").appendTo(document.body).kendoWindow({
        name: "window",
        resizable: true,
        width: 100,
        height: 100,
        scrollable: false,
        content: { url: 'Cliente/ClienteIndex' },
        iframe: true,
        modal: false,
        title: 'title',
        actions: ["Refresh", "Minimize", "Maximize", "Close"],
        close: function (e) {
            this.destroy();
        }
    });

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Feb 2013, 07:13 AM
Hello Gaetano,

The area is part of the URL so you should use one in the following format:

content: { url: '/AreqName/ControllerName/ActionName' }
If you are using the script in a View you may also use the Url.Action helper to generate the correct address.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gaetano
Top achievements
Rank 1
answered on 14 Feb 2013, 09:42 PM
Hi Daniel,
unfortunatly this doesn't work, i receive a 404 Error (Not found)

content: { url: '/Logistica/Test/Index' },

below there are the following file:
  1. TestController.vb
  2. View.aspx
  3. LogisticaAreaRegistration.vb
  4. A piece of global.asax.vb


File:  TestController.vb:
Namespace JSeven
    Public Class TestController
        Inherits System.Web.Mvc.Controller
        ' GET: /Logistica/Test
        Function Index() As ActionResult
            Return View()
        End Function
    End Class
End Namespace

File: Index.aspx
<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Index</h2>
</asp:Content>


File: LogisticaAreaRegistration.vb
Namespace JSeven.Areas.Logistica
    Public Class LogisticaAreaRegistration
        Inherits AreaRegistration
        Public Overrides ReadOnly Property AreaName() As String
            Get
                Return "Logistica"
            End Get
        End Property
        Public Overrides Sub RegisterArea(ByVal context As System.Web.Mvc.AreaRegistrationContext)
            context.MapRoute( _
                "Logistica_default", _
               "Logistica/{controller}/{action}/{id}", _
                New With {.action = "Index", .id = UrlParameter.Optional} _
            )
        End Sub
    End Class
End Namespace

File: Global.asax
Sub Application_Start()
        AreaRegistration.RegisterAllAreas()
        RegisterGlobalFilters(GlobalFilters.Filters)
        RegisterRoutes(RouteTable.Routes)
End Sub


Do you have any idea?
Thanks in advance
Gaetano
0
Gaetano
Top achievements
Rank 1
answered on 14 Feb 2013, 09:48 PM
HI Daniel,
sorry the error was the namespace of the controller class does not match the namespace of the LogisticaAreaRegistration class.
Modifing this mismatch, all work fine.
Thank you.
Gaetano
Tags
Window
Asked by
Gaetano
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Gaetano
Top achievements
Rank 1
Share this question
or