We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Action in the same area is not working

Thread ID:

Created:

Updated:

Platform:

Replies:

149219 Nov 19,2019 10:50 AM UTC Nov 21,2019 12:46 PM UTC ASP.NET Core - EJ 2 3
loading
Tags: DataGrid
John Stephen Mangam
Asked On November 19, 2019 10:50 AM UTC

Hi,

Failed to load resource: the server responded with a status of 404 ()


Admin area - View is Index

<ejs-grid id="filesSearchGrid" ... >
    <e-data-manager url="@Url.Action("GetFilesForAdmin", "Test", new { Area = "" })" adaptor="UrlAdaptor"></e-data-manager>


Pavithra Subramaniyam [Syncfusion]
Replied On November 20, 2019 09:40 AM UTC

Hi John, 
 
Thanks for contacting Syncfusion support. 
 
We could see that you want sent a request by using Areas property and you can achieve your requirement by setting the routing in startup.cs file. 
 
 We have created the sample by following the steps in the documentation , in which we have sent a request to the Home1 Controller under Products  Area by adding route ( areaName: "Products" ) in the startup.cs file. Please refer the below code example, sample and screenshot for information. 
 
Index.cshtml 
 
<ejs-grid id="Grid" allowPaging="true" allowSorting="true" allowFiltering="true" toolbar="@(new List<string>() {"Search" })"> 
    <e-data-manager url="@Url.Action("UrlDatasource", "Home1",new { Area = "" })" adaptor="UrlAdaptor"></e-data-manager> 
------------ 
</ejs-grid> 
  
Areas/Products/Controllers/Home1 
 
namespace WebApplication7.Controllers 
{ 
    [Area("Products")] 
    public class Home1Controller : Controller 
    { 
        ------------ 
    } 
     public IActionResult UrlDatasource([FromBody]DataManagerRequest dm) 
        { 
            IEnumerable DataSource = OrdersDetails.GetAllRecords(); 
            ----------- 
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
} 
 
Startup.cs 
 
public void Configure(IApplicationBuilder app, IHostingEnvironment env){ 
app.UseMvc(routes => 
            { 
                routes.MapAreaRoute( 
           name: "MyAreaProducts", 
           areaName: "Products",     // here you have to add your areaName where to fetch 
 
           template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"); 
 
                routes.MapAreaRoute( 
                    name: "MyAreaServices", 
                    areaName: "Services", 
                    template: "Services/{controller=Home}/{action=Index}/{id?}"); 
                routes.MapRoute( 
                    name: "default", 
                    template: "{controller=Home}/{action=Index}/{id?}"); 
            }); 
} 
 
Screenshot:  
 
 
 
 
 
Please get back to us, if you need further assistance. 
 
Regards, 
Pavithra S. 
 


John Stephen Mangam
Replied On November 20, 2019 11:42 AM UTC

Hi,

I'm using asp.net core 3.0

My startup code is:

 app.UseEndpoints(routes =>
            {
...
                  routes.MapAreaControllerRoute(
                    "Admin",
                    "Admin",
                    "Admin/{controller=Home}/{action=Index}/{id?}");
...

Pavithra Subramaniyam [Syncfusion]
Replied On November 21, 2019 12:46 PM UTC

Hi John, 
 
Thanks for your update. 
 
We have validated the provide details and created the sample with version ASP.Net Core 3.0. In that we have sent a request to the Home1 Controller under Products in Areas by adding route ( areaName: "Products" ) in the startup.cs file. Please refer the below code example and sample for information. 
 
Index.cshtml 
 
<ejs-grid id="Grid" allowPaging="true" allowSorting="true" allowFiltering="true" toolbar="@(new List<string>() {"Search" })"> 
    <e-data-manager url="@Url.Action("UrlDatasource", "Home1",new { Area = "" })" adaptor="UrlAdaptor"></e-data-manager> 
------------ 
</ejs-grid> 
  
Areas/Products/Controllers/Home1 
 
namespace WebApplication7.Controllers 
{ 
    [Area("Products")] 
 
    public class Home1Controller : Controller 
    { 
        ------------ 
    } 
     public IActionResult UrlDatasource([FromBody]DataManagerRequest dm) 
        { 
            IEnumerable DataSource = OrdersDetails.GetAllRecords(); 
            ----------- 
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
} 
 
Startup.cs 
 
public void Configure(IApplicationBuilder app, IWebHostEnvironment env){ 
-------- 
app.UseEndpoints(endpoints => 
            { 
                endpoints.MapControllers(); 
                endpoints.MapAreaControllerRoute( 
                    "Products", 
                    "Products",  // here you have to set your area name 
                    "{area:exists}/{controller=Home}/{action=Index}/{id?}"); 
                endpoints.MapControllerRoute( 
                    "default", "{controller=Home}/{action=Index}/{id?}"); 
                endpoints.MapControllerRoute( 
                    name: "default", 
                    pattern: "{controller=Home}/{action=Index}/{id?}"); 
            }); 
} 
 
 
Please get back to us, if you need further assistance. 
 
Regards, 
Pavithra S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon