Issue Description:
User is creating an MVC module.The module shows the page as expected, however when tries to call a controller action from JavaScript, it gives a 404 error. Here is the controller:
public ActionResult Index()
{
return View();
}
public ActionResult ShowPartialPage(string Id)
{
return PartialView("Test");
}
the showpartialpage is called from javascript:
$.ajax({
url: dnn.getVar("sf_siteRoot", "/") + "DesktopModules/MVC/MyModule/Item/ShowPartialPage?Id=ABC",
method: "Get",
})
.done(function(data) {
if (console && console.log) { }
});
Now when user tries to access the page from browser it gives that 404 error.
Issue Resolution:
Upon reviewing the first Ajax call with the 404 error, user needs to set the path in the routeconfig to be Dnn.Modules.ExperimentalModule so it needs to use that one to get the partial view.
$.ajax({
url: siteRoot + "DesktopModules/MVC/Dnn.Modules.ExperimentalModule/Item/Test",
data: ({ Id: 'ABC' }),
headers: {
"ModuleId": ModuleId,
"TabId": TabId
},
method: "Get",
})
Additionally, user needs to change the routing to:
mapRouteManager.MapRoute("ExperimentalModule", "ExperimentalModule", "{controller}/{action}", new[]
{"Dnn.Modules.ExperimentalModule.Controllers"});
Either one of these should resolve the issue, and the partial view will load as expected.
Comments
0 comments
Please sign in to leave a comment.