Questions tagged [actionmethod]

Action methods typically have a one-to-one mapping with user interactions. Examples of user interactions include entering a URL into the browser, clicking a link, and submitting a form. Each of these user interactions causes a request to be sent to the server. In each case, the URL of the request includes information that the MVC framework uses to invoke an action method.

Most action methods return an instance of a class that derives from ActionResult. The ActionResult class is the base for all action results. However, there are different action result types, depending on the task that the action method is performing. For example, the most common action is to call the View method. The View method returns an instance of the ViewResult class, which is derived from ActionResult.

You can create action methods that return an object of any type, such as a string, an integer, or a Boolean value. These return types are wrapped in an appropriate ActionResult type before they are rendered to the response stream.

135 questions
0
votes
1 answer

Ajax.RouteLink gives a 404

I have this link @Ajax.RouteLink("Bid", RouteNames.Ajax.BidOnLot, new { lotId = Model.Lot.Id, bidAmount = Model.NextBidAmountForUser }, new AjaxOptions { …
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
0
votes
1 answer

PHP MVC: 404 error when action-methodname contains show

I have a very strange problem in my current custom PHP MVC project. If a controller methodname contains show (fx show_album), apache throws a 404 page not found? Du you have any ideas why this happens? .htaccess: #mod_rewrite start Options…
Sune
  • 607
  • 2
  • 8
  • 17
0
votes
2 answers

How to get Uri of view returned by action method?

I need to serialize some object into xml, which has string property "Url" - url of page returned by some action method (in asp.net mvc 3 app I want to implement custom rss). I guess to call action method I just need to instantiate the controller…
Aleksei Chepovoi
  • 3,915
  • 8
  • 39
  • 77
0
votes
3 answers

mvc 3 - Automatically going to HttpPost

I have an action as follows: public ActionResult ChangeFeeCheck(string id) { ViewBag.id = id; return View(); } on my View, I have the following: @{ ViewBag.Title = "CreateList"; } Please enter first…
Nate Pet
  • 44,246
  • 124
  • 269
  • 414
0
votes
1 answer

passing graphics object to action method

I need to pass the grapics object 'g' to the action method from the paint method. Something like this: public boolean action(Event event, Object obj) { Graphics g=getGraphics(); repaint(); if (event.target == choice) String…
Isabel Inc
  • 1,871
  • 2
  • 21
  • 28
0
votes
1 answer

How to pass data from a form to controller using ASP.NET MVC

I have a form defined thus in a razor file. @using (Html.BeginForm()) { } Within this form I have fields such as and a couple of structures like
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
0
votes
1 answer

Empty Enumeration in post method

I have this view @model IEnumerable ... ... @{ using (Html.BeginForm(new { round1Ring3Bids = Model })) { if (Model != null && Model.Count() > 0) { ... ... @for…
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
0
votes
1 answer

Passing data to post method

I have a view model that looks like this public class ViewModelRound2 { public Bid Bid { get; set; } public bool SelectedForRound2 { get; set; } } I have a get action method that looks like this public ActionResult…
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
0
votes
1 answer

Rails 3 simultaneously rendering response of more than one action of a controller in another controller's view

Using Rails v 3.0.11, Ruby v 1.9.3 I have a page having link "Reports" on it, clicking on which invokes ReportsController#index class ReportsController < ApplicationController def index # Renders index.html.haml end end Now I have an…
Jignesh Gohel
  • 6,236
  • 6
  • 53
  • 89
0
votes
3 answers

When invoked with a jQuery $.ajax, what to return from the Action Method if things go ok?

Here's my code: [HttpPost] public ActionResult VoteChampionStrongAgainst(string championStrong, string againstChampion) { int champStrongId = int.Parse(championStrong); int againstChampId = int.Parse(againstChampion); …
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257
0
votes
3 answers

How to pass a list of objects instead of one object to a POST action method

I have the following GET and POST action methods:- public ActionResult Create(int visitid) { VisitLabResult vlr = new VisitLabResult(); vlr.DateTaken = DateTime.Now; ViewBag.LabTestID = new SelectList(repository.FindAllLabTest(),…
John John
  • 1
  • 72
  • 238
  • 501
0
votes
3 answers

Confused about how Controllers actually map to views in this case

I have these two URL's I want to make available to my users: /Account/Orders <- This would should be a grid of all orders. /Account/Orders/132 <- This would show this particular order information. Here are my two…
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257
-1
votes
1 answer

I want to return a table and the number of rows present in the table as a response

I have to send the noOfRecords variable in the response. public HttpResponseMessage GetWareHouses(int pageNumber, int noofRows) { var result = myModelObject.SelectTableData(pageNumber, noofRows); int numberOfRec = result.Count; /*I need to send…
-1
votes
1 answer

Comprehensive list of MVC controller action method parameter auto-mapping features?

Every time I look at an MVC action method, I find a new feature. First, it seems to pull in route parameters automatically into matching parameter names (e.g. "id"), along with form fields, query strings, and cookies. Then I discover that if you…
Triynko
  • 18,766
  • 21
  • 107
  • 173
-1
votes
1 answer

MVC Action has missing data

I send my viewmodel from my get action method to a view for update, the view has a submit button which takes returns control to the post action method. The viewmodel is of this form public class MyViewModel { public someObject a; public…
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
1 2 3
8
9