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

Unexpected route chosen while generating an outgoing url

Please, consider the following routes: routes.MapRoute( "route1", "{controller}/{month}-{year}/{action}/{user}" ); routes.MapRoute( "route2", "{controller}/{month}-{year}/{action}" ); And the following tests: TEST…
horgh
  • 17,918
  • 22
  • 68
  • 123
14
votes
1 answer

TempData won't destroy after second request

I'm putting a value into TempData on first request in an actionfilter. filterContext.Controller.TempData["value"] = true; after that a second request comes in and I check for the value filterContext.Controller.TempData.ContainsKey("value") the…
user49126
  • 1,825
  • 7
  • 30
  • 53
14
votes
3 answers

ValidationMessageFor together with AddModelError(key, message). What's the key?

I am developing a client-side and server-side validation for a certain viewModel property. In the .cshtml file I put this: @Html.DropDownListFor(model => model.EntityType.ParentId, Model.ParentTypeList, "") @Html.ValidationMessageFor(model =>…
14
votes
7 answers

MVC: No parameterless constructor defined for this object

I have the following controller definition public class FeaturedAccommodationController : Controller { ... public FeaturedAccommodationController(IAccommodationService accommodationService) { ... } public ActionResult…
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
14
votes
5 answers

Assembly 'SomeAssembly, uses 'System.Web.Mvc, Version=4.0.0.0, which has a higher version than referenced assembly 'System.Web.Mvc, Version 3.0.0.0

I get the following error below after opening and compiling my VS 2010 .net 4.0 MVC3 project in VS 2012 RTM. How can I fix this without upgrading to MVC4? I have VS 2010 and VS 2012 installed side by side. Error 1 Assembly 'SomeAssembly,…
kyleb
  • 1,968
  • 7
  • 31
  • 53
14
votes
3 answers

FormsAuthentication.SetAuthCookie throwing NullReferenceException in async action

I am finding that FormsAuthentication.SetAuthCookie is throwing a NullReferenceException - Object reference not set to an instance of an object inside an async action on an azure website. I found the…
Tom
  • 12,591
  • 13
  • 72
  • 112
14
votes
8 answers

adding "name" attribute to CheckBoxFor

I am trying to add a "name" attribute to my CheckBoxFor and can't get it to work. @Html.CheckBoxFor( model => model.ProvidePracticalSuggestions, new { @name = "help_practicalSuggestions" }) Any idea what I am doing wrong…
user547794
  • 14,263
  • 36
  • 103
  • 152
14
votes
1 answer

How to get current username instead of AppPool identity in a logfile with Log4Net

We are using Log4Net from our ASP.NET MVC3 application, all works fine but we would like to see the current username instead of the application pool's identity in the log files, this is the appender configuration we are using:
Davide Piras
  • 43,984
  • 10
  • 98
  • 147
14
votes
4 answers

How to Pass textbox value using @html.actionlink in asp.net mvc 3

How to Pass value from text using @html.actionlink in asp.net mvc3 ?
kiransh
  • 369
  • 2
  • 4
  • 15
14
votes
4 answers

ASP.Net MVC 3 Razor Concatenate String

I have the following in my ASP.Net MVC 3 Razor View @foreach (var item in Model.FormNotes) { @Html.DisplayFor(modelItem => item.User.firstName) } Which works fine, however, I would like to concatenate the…
tcode
  • 5,055
  • 19
  • 65
  • 124
14
votes
5 answers

MVC Model Binding to a collection where collection does not begin with a 0 index

I'm trying to perform remote validation on a property of an item within a collection. The validation works OK on the first item of the collection. The http request to the validation method looks…
FloatLeft
  • 1,317
  • 3
  • 23
  • 40
14
votes
5 answers

Adding html Input inside an html label

So I'm using Twitter Bootstrap and most of my forms are looking fantastic with this
@Html.LabelFor(m => m.Prop)
@Html.EditorFor(m => m.Prop) …
James Troutman
  • 211
  • 1
  • 2
  • 5
14
votes
2 answers

Extend MVC3 razor Html.LabelFor to add css class

I am trying to add a css class to Html.LabelFor on an EditorTemplate @Html.LabelFor(model => model.Name, new { @class = "myLabel" }) my expectation for instance:label should pick up the css class. For this I tried to extend Label with the…
Millar
  • 1,095
  • 6
  • 16
  • 34
14
votes
1 answer

How to organize the JavaScript Code in ASP.NET MVC applications

We are to add some Ajax functions on a view page. Say, click a delete or insert button and an Action will be called to perform a CRUD job behind the scene and then refresh the items list after that operation. In many existing examples, the…
Blaise
  • 21,314
  • 28
  • 108
  • 169
14
votes
7 answers

MVC 3 : The MSDTC transaction manager was unable to pull the transaction from the source

I am using MVC 3 with Entities, now I have used the below line of codes from my controller using (var scope = new TransactionScope()) { _myRepository.DeleteFM1(id); _myRepository.DeleteFM2(id, name); …
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
1 2 3
99
100