Questions tagged [asp.net-mvc-3]

ASP.NET MVC 3 is the third major version of Model-View-Controller extension for developing web applications in a .NET framework.

ASP.NET MVC 3 is the third major version of the ASP.NET Model-View-Controller platform for web applications.

It supports the following new features:

Demos and Tutorials:

  1. Intro to ASP.NET MVC 3 (VB)
  2. Intro to ASP.NET MVC 3 (C#)

References:

See for more information.

38473 questions
14
votes
2 answers

How to add properties to anonymous object dynamically?

Possible Duplicate: Is it possible to declare an anonymous type in C# with a variable/dynamic set of fields? I've built a query builder that constructs a query by examining some GET values that the user has set in my ASP.NET MVC3 application. This…
Leon Cullens
  • 12,276
  • 10
  • 51
  • 85
14
votes
6 answers

RedirectToAction Causes "No route in the route table matches the supplied values" in ASP.NET MVC 3

I have a project that I recently upgraded to ASP.NET MVC 3. On my local machine, everything works fine. When I deploy to the server, I get an error anytime I use a RedirectToAction call. It throws a System.InvalidOperationException with the error…
Schmalls
  • 1,434
  • 1
  • 19
  • 19
14
votes
3 answers

ValidateRequest in Razor syntax

I have the following header of ASP.Net MVC page: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage" ValidateRequest="false" %> I need to move this…
Oleg Sh
  • 8,496
  • 17
  • 89
  • 159
14
votes
4 answers

System.ArgumentException: Duplicate type name within an assembly

I am working on an ASP.Net MVC 3 web application using EF 4.1. Since today, I am getting this error: System.ArgumentException: Duplicate type name within an assembly and I can't figure out what is causing it. It is happening in my repository when…
Jean-François Beauchamp
  • 5,485
  • 8
  • 43
  • 77
14
votes
4 answers

How to load a partial view containing JavaScript?

In one of my View pages I have a asp.net mvc PartialView. The PartialView contains some javascript (and jquery). In my asp.net main View I load the PartialView using ajax, within a div tag, in way given below. That is, from controller I return…
Jatin
  • 4,023
  • 10
  • 60
  • 107
14
votes
2 answers

MVC3 JSON Serialization: How to control the property names?

I want to serialize a simple object to JSON: public class JsonTreeNode { [DataMember(Name = "title")] public string Title { get; set; } [DataMember(Name = "isFolder")] public bool IsFolder { get; set; } [DataMember(Name =…
xsl
  • 17,116
  • 18
  • 71
  • 112
14
votes
1 answer

StringLength attribute behaviour

I have such attribute which is checking for minimum and maximum string length: [StringLength(10, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 3)] public string PropertyName {get; set;} Basically it is how it…
Joper
  • 8,019
  • 21
  • 53
  • 80
14
votes
1 answer

MVC3 globalization: need global filter before model binding

Currently, I have a global filter called GlobalizationFilter that checks the route values, cookies and browser languages header to determine the correct culture settings for the request: public override void OnActionExecuting(ActionExecutingContext…
Zruty
  • 8,377
  • 1
  • 25
  • 31
14
votes
1 answer

Throwing a 404 like StackOverflow's, without redirect, when using IOCControllerFactory

I found another question posted on here which provided a solution to the first part of my question, i.e. how to generate a 404 page in ASP.NET MVC WITHOUT redirecting to another page (so the originally requested url remains in the address…
marcusstarnes
  • 6,393
  • 14
  • 65
  • 112
14
votes
1 answer

How to set MSDeploy settings in .csproj file

Is there a way to set MSDeploy parameters in .csproj file itself of ASP.NET MVC project? Particularly a "skip" parameter, which should skip a "Temp" folder. -skip:objectName=dirPath,absolutePath="\\temp" .. or how can I pass this parameter into…
Grief Coder
  • 6,508
  • 9
  • 38
  • 51
14
votes
6 answers

how to handle "OPTIONS Method" in ASP.NET MVC

My Sencha Touch app is posting a form to my asp.net-mvc-3 WebService, but instead of sending POST it's sending OPTIONS. I'm reading a similar thread here, but I just don't know how to handle the OPTIONS method in my code. I did try adding the…
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
14
votes
2 answers

Strange behaviour with asp.net mvc action filters AttributeUsage

I have an action filter with the following signature [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class UnitOfWorkAttribute : ActionFilterAttribute According to MSDN: The AllowMultiple property indicates whether multiple…
Ben Foster
  • 34,340
  • 40
  • 176
  • 285
14
votes
2 answers

How do I remove "Use Directory" message from ReSharper

I just started a MVC3 Razor application and started typing out in one of the .cshtml files and I added an a tag with href, when I entered the location it keeps telling me to use a directory that it wants me to use. I cannot get rid of this and it is…
JakeJ
  • 1,381
  • 3
  • 14
  • 34
14
votes
1 answer

Asp.net error Could not load file or assembly

Possible Duplicate: After a computer crash my Visual Studio 2010 will not load an assembly I have a web application in Asp.net MVC 3 developed in VS 2010. Today while working my laptop got rebooted due to some reason and from that time onward…
pramodtech
  • 6,300
  • 18
  • 72
  • 111
14
votes
2 answers

ASP.NET MVC3 JSON Model-binding with nested class

In MVC3, is it possible to automatically bind javascript objects to models if the model has nested objects? My model looks like this: public class Tweet { public Tweet() { Coordinates = new Geo(); } public string Id { get;…
jul
  • 1,054
  • 2
  • 11
  • 24