Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDNN MVC Executing action by AJAXDNN MVC Executing action by AJAX
Previous
 
Next
New Post
3/16/2016 10:27 AM
 

Hi,

Another problem occured in my DNN MVC development journey. I am wondering whether this is a bug/missing feature of I've made a mistake. 
I will try to explain the problem and my attempts to resolve/bypass it. 

What do I want to achieve?
I want to execute an action in my controller by calling an AJAX post. So far it works.
However, when I try to return some variables to my View, it doesn't only return the variables. It adds an whole HTML-source to the response.

My controller
My method returns an ActionResult (I tried JsonResult and something different: HttpResponseMessage)
The program itself is working and does return the json-message.


My view
The View below isn't my final View, but's meant to test.

Does anybody know why it is returning an whole HTML-source instead of just the specified variables? Is this a bug, or something I am able to fix? Thank you very much for your time.

 
New Post
5/8/2017 4:00 PM
 
I know this thread is old. But I was running into this issue and was finally able to resolve it. I thought I'd share my solution in case anyone else is still having this problem.

For me, I was missing a RouteConfig.cs in my project.

Here is the code I used (sorry for the formatting, I am unable to load the full reply page, so I'm stuck with the quick reply box and don't know the formatting syntax):
using DotNetNuke.Web.Mvc.Routing;

namespace ModuleNamespace
{
public class RouteConfig : IMvcRouteMapper
{
public void RegisterRoutes(IMapRoute mapRouteManager)
{
mapRouteManager.MapRoute("ModuleName", "ModuleName", "{controller}/{action}", new[]
{"ModuleNamespace.Controllers"});
}
}
}


Once I added that file in, I no longer got the extra HTML in my responses. Without the mapping, I was getting my JSON and the page load source, which was causing some database connection issues for me.

Hope this helps!
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDNN MVC Executing action by AJAXDNN MVC Executing action by AJAX


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out