Questions tagged [actionresult]

The value returned by the Struts 2 Action class method when it completes.

The value returned by the Struts 2 Action class method when it completes. Actually, it returns a String type value. The value of the String is used to select a result element of the configuration. An action configuration will often have a set of result configurations representing different possible outcomes. A standard set of result tokens are defined by the Action interface are:

String SUCCESS = "success";
String NONE    = "none";
String ERROR   = "error";
String INPUT   = "input";
String LOGIN   = "login";

Further details are available: http://struts.apache.org/release/2.3.x/docs/result-configuration.html

457 questions
2
votes
2 answers

MVC String in ActionResult

I am using the default Controller named "Home". I have the following ActionResult: public ActionResult SetID(string ID) { int? result = MyGateway.GetAccountByID(ID); Common.IDNum = result; return View("Index","Home"); } I would like to…
Turp
  • 708
  • 3
  • 14
  • 26
2
votes
1 answer

Custom ActionResult to return View = Model is ReadOnly

I've got a snippet of code in a custom ActionResult VB.NET Version Dim result As New ViewResult() result.Model= data ## Property Model is ReadOnly Return result C# Version ViewResult result = new ViewResult(); result.Model = data; // Property…
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
2
votes
2 answers

How to make ASP.NET MVC Action return different formats?

I don't know if this is the right way to approach something, but I'm hoping it is. The example below is a heavy controller and is absolutely the wrong approach, but it get's the idea of what I'm looking for across. public class PeopleController :…
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
2
votes
1 answer

Asp.Net MVC SiteMap - siteMapNode: How to redirect to Controller ActionResult

I have a simple menu based on a standard xml sitemap, that when a link is clicked I want it to post to a controller actionresult that does not have a view/page. I don't seem to have a problem when I have a view or page or other website for the url…
2
votes
4 answers

Ajax call not working when trying to send & return raw html

I am using Ajax call to invoke C# method that is processing user paste input by removing unwanted html tags and attributes. When I paste in content with html formatting (tags & attributes), my Ajax call doesn't work. Can you please advise how Ajax…
Tom S
  • 127
  • 1
  • 4
  • 18
2
votes
2 answers

How do I perform a secondary action (i.e. calculate fields) in ASP.NET MVC?

I need to do some calculations on an ASP.NET MVC View, an action different than the form submission. I've tried various methods of passing the current Model on to a new controller action via an ActionLink, but the model doesn't appear to be…
paulwhit
  • 8,719
  • 4
  • 29
  • 30
2
votes
1 answer

ASP.NET MVC 3 get HTML from viewmodel

I have a Controller with a method like this: public ActionResult Index() { CustomerInfoViewModel viewModel = CustomerInfoModel.Load(); return View("Report", viewModel); } Now I'd like to create another method which does the same than this…
Diego
  • 16,436
  • 26
  • 84
  • 136
2
votes
1 answer

Returning custom HttpResponseMessage as IActionResult

I have a web api which returns IActionResult. I return FileContentResult from this api like this return new FileContentResult(model.Content, ContentType) { EnableRangeProcessing = true }; I have a requirement in which I now want to control…
Pawan Nogariya
  • 8,330
  • 12
  • 52
  • 105
2
votes
1 answer

Which class does this c# File belongs to

I am trying to return a file content via the ActionResult. However, I cannot find which library the File() functions belong to. So the File(..) is not valid. Which library does the File belong to ? I need to add it. Is it belong to system.web.mvc?…
want_to_be_calm
  • 1,477
  • 3
  • 23
  • 41
2
votes
2 answers

does an MVC Action have to return an actionResult?

Can a so called action in my controller just be a regular function that returns anything I want or does the return of an ActionResult declare whether its an "action" or not? I was wondering if i could call functions in my ActionLink in the…
Dacrocky
  • 447
  • 5
  • 12
2
votes
1 answer

Automatic action result call from Javascript MVC

I am working on a website and I am wanting to redirect to Action Result called logout automatically in 20 second. This is what I have so far: setInterval(function redirectAction() { var url = '@Url.Action("Logout")'; }, 20000); The timing…
2
votes
2 answers

What should my JSON string look like in my Action?

in .NET MVC my action looks like: public ActionResult TestAjax(string testID) { return Content(@"{first: ""1"", second : ""2""}"); } In my JavaScript I am doing: function(data) { alert(data.first); } I am getting [object Object] as the…
mrblah
  • 99,669
  • 140
  • 310
  • 420
2
votes
0 answers

Access DbContext in Helper Class

I am using Razorpages in ASP.NET Core I have a simple detailsModel that brings in the different DbContext from Entity Framework (EF) using the constructor parameters. this means that my DbContexts are available when performing different actions…
2
votes
1 answer

Returning custom data along with actionresult from an action method

I am sure many people have had this question but I failed to get any results after searching the web and SO or the search keywords were different. I am working on a new asp.net mvc web app where I get a plain template returned by the index action…
Subbu
  • 588
  • 1
  • 7
  • 18