Accessing to Controller in another area with DataSource

3 posts, 0 answers
  1. Paolo
    Paolo avatar
    423 posts
    Member since:
    Jun 2009

    Posted 26 Aug 2013 Link to this post

    Hello Telerik,
    I need to access to a control defined in a different area from the one my page is currently in... for example if I'm in Admin area I want to access to a CommonController defined in the main Controller folder (so Area = null)

    In the specific I'm using a dropdown but in future I'll use it for grid as well... my code is

    @(Html.Kendo().DropDownList()
              .Name("cbAccount")
              .HtmlAttributes(new { style = "width: 250px" })
              .DataTextField("Descr")
              .DataValueField("ID")
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      read.Action("GetListaAccount", "Common");
                  }).ServerFiltering(false);
              })
        )
    It looks for a Common controller under the Admin area...I've tried specifing the routeValues as new {Area=null} or new {Area="Foo"} but I don't even see the call to the service...what am I doing wrong?

    Thanks
    Paolo
  2. Paolo
    Paolo avatar
    423 posts
    Member since:
    Jun 2009

    Posted 26 Aug 2013 Link to this post

    We've fixed by using new { Area = string.Empty }, is this correct?

    Thanks
    Paolo
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 28 Aug 2013 Link to this post

    Hello,

    Yes, the approach is correct. You should specify an empty string for the area if the controller is not in an area.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top