Questions tagged [asp.net-mvc-controller]

The ASP.NET MVC framework maps URLs to classes that are referred to as controllers. Controllers process incoming requests, handle user input and interactions, and execute appropriate application logic. A controller class typically calls a separate view component to generate the HTML markup for the request.

The base class for all controllers is the ControllerBase class, which provides general MVC handling. The Controller class inherits from ControllerBase and is the default implement of a controller.

The Controller class is responsible for the following processing stages:

  • Locating the appropriate action method to call and validating that it can be called.
  • Getting the values to use as the action method's arguments.
  • Handling all errors that might occur during the execution of the action method.
  • Providing the default WebFormViewEngine class for rendering ASP.NET page types (views).
193 questions
0
votes
1 answer

How to get action from which have been redirected?

Is there a way to get the name of the action from which I have been redirected inside a controller in ASP.NET MVC3? (By the way, without saving the name of the action in TempData nor Session)
0
votes
0 answers

Setting masterpage dynamically in multi-tenant solution.

I created a multi tenant solution in .net mvc4 that works great. I only have one last issue left. I created my own controller with OnResultExecuting, this is good because it allows me to deal with masterpages while still maintaining my multi-tenant…
0
votes
0 answers

Ajax call accepts json but controller returns html

So, I have been using $.getJson() successfully to grab data. In this instance, I needed to synchronously grab data from the server, so I used: $.ajax({ type: "GET", async: false, url: "/Mapping/MappingExists?id=" + id, dataType:…
ScubaSteve
  • 7,724
  • 8
  • 52
  • 65
0
votes
1 answer

Routing to a controller from the Url address bar

By default all incoming calls go to the home controller. but what I'm trying to do is type in a different controller and go there. MVC4 www.mywebsite.com this will go to the home controller. www.mywebsite.com/test this needs to go to the test…
NNassar
  • 485
  • 5
  • 11
  • 25
0
votes
1 answer

MVC 4: passing single inherited models into the main model to a partial view

Am trying to figure this out. I have a major class called Foods. I have multiple classes that inherit from Food: Pizza, Sandwich, Meals etc... I created the database using Code First Approach. The database has tables for Pizza, Sandwich and…
0
votes
1 answer

Multiple parameters in asp.net MVC 4 controller

I'm using VS2010 and ASP.NET MVC 4 for my project. I need a controller that should get 2 parameters. this is my controller method: [AcceptVerbs(HttpVerbs.Get)] public ActionResult AcceptBid(int? Id, int? Accept) { if (Id != null && Accept !=…
0
votes
2 answers

How to pass a list of objects to a [HTTPPost]controller parameter, in ASP.Net MVC?

i have the next view: @model IEnumerable @using (Html.BeginForm("ExpenseMonthlyTransferProcessing", "BudgetTransfer", Model.ToList())){ …
Lio
  • 5
  • 1
  • 3
  • 5
0
votes
2 answers

MVC 3 Uploading File - Null File in Controller

I don't know what I'm missing, but I need to upload a file using C# MVC 3. I followed instructions here in SO, but the file is always empty. Here is my actual testing code: HTML @using (Html.BeginForm("Prc", "Upload", FormMethod.Post, new { enctype…
Devmonster
  • 699
  • 1
  • 10
  • 28
0
votes
1 answer

Patterns for creating MVCControllers from EF Repositories

[This blog post titled: 'Passing multiple Include statements into a Repository' provides a great overview of how to control the depth of loaded children when hydrating an EF dbContext-based object. A very nice explanation of feeding the repository…
justSteve
  • 5,444
  • 19
  • 72
  • 137
-1
votes
1 answer

Auto save a drop down list

I have a drop down list for feed back. I save the data when save button is pressed. I want to auto save the drop down list without using save button how i can do it? here is my ontroller public ActionResult SelectFeedBack(int id) { …
-1
votes
2 answers

ASP.NET MVC - where should my function put? Controller? Model?

For example, I have a password generator in my user registration website. Where should I put the function of generating password? Put together with UserController? What is the correct way to put these functions?
user2584307
  • 82
  • 1
  • 5
-1
votes
1 answer

the View cannot be rendered from Controller

I have a view which I want to change its data by changing a DropDownList. Everything works fine but the View doesn't render with new set of data. In other word when I post data to an action method in controller it cannot return to view. here is my…
Majid Shahabfar
  • 4,010
  • 2
  • 28
  • 36
-2
votes
1 answer

Correctly override the generic BaseController

I have the generic BaseController like this: public class BaseController : Controller where T : BaseEntity { protected readonly IRepository _repository; public BaseController(IRepository repository) { _repository =…
serge
  • 13,940
  • 35
  • 121
  • 205
1 2 3
12
13
Transferir