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

Accessing to Controller in another area with DataSource

2 Answers 828 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 26 Aug 2013, 12:59 PM
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 Answers, 1 is accepted

Sort by
0
Michele
Top achievements
Rank 2
answered on 26 Aug 2013, 01:02 PM
We've fixed by using new { Area = string.Empty }, is this correct?

Thanks
Paolo
0
Daniel
Telerik team
answered on 28 Aug 2013, 12:11 PM
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!
Tags
General Discussions
Asked by
Michele
Top achievements
Rank 2
Answers by
Michele
Top achievements
Rank 2
Daniel
Telerik team
Share this question
or