asp.net-mvc-2

Html.LabelFor helper in MVC2

Hi, I'm using MVC2, Preview 2. Why is it that when I use: <%= Html.LabelFor(x => x.Nombres) %> <%= Html.Encode(Model.Nombres) %> It outputs: Nombre: Sr. Fulano de Tal But when I use: Nombres: <%= Html.Encode(Model.Nombres) %> it outputs: Nombre: Sr. Fulano de Tal I don't want the return after ...

Asp.net Mvc 2 DisplayFor Performance Issue?

Hi, In my recent project which is using Asp.net Mvc 2, we found that the DisplayFor has performance issue. I'm not so sure whether it is the real issue or did I miss something? I hope some Asp.net Mvc Guru can explain it to me. :) Model. public class Customer { public int CustomerId { get; set; } public string Name { get; set;...

How To Deploy Web Application

We have an internal web system that handles the majority of our companies business. Hundreds of users use it throughout the day, it's very high priority and must always be running. We're looking at moving to ASP.NET MVC 2; at the moment we use web forms. The beauty of using web forms is we can instantaneously release a single web page...

ASP.Net MVC 2.0 Html.HiddenFor HtmlHelper extension doesn't return the Value.

We're trying to be type-safe in our views and use the new ExpressionInputExtenssion HtmlHelpers, but we are seeing some inconsistent results. We have a view that looks like this: ViewData.Model.FooID = <%= ViewData.Model.FooID %>< Model.FooID = <%= Model.FooID %> <%= Html.HiddenFor(x=>x.FooID) %> But what we see in the rendere...

Did Html.RenderAction make it into VS2010/ ASP.NET 4?

We are planning to use VS2010 later in the future, but currently working on 2008. Since the RenderAction is still a Future, we want to be sure it will be a "Production Quality" component later, when we do decide to move to VS2010... Does anybody knows if it made it into VS2010 b2? Thanks ...

Why does not specifying view name cause my unit test to fail?

In my unit tests, I find that when I return from a controller action using View() with no view name, ViewResult.ViewName is set to string.Empty. In order for this to be set, it has to be specified as a parameter to the View() call. For example, given the following unit test: [TextFixture] public class MyControllerTests { [Test] ...

Is IDataErrorInfo ignored during model validation in MVC 2?

I currently migrated my project to MVC 2 and IDataErrorInfo doesn't seem to work when using default model binding and validation. Is it cut out? ...

ASP.NET MVC 2 Beta - Default Model Binder

I'm experiencing some different behavior after switching from ASP.NET MVC 1.0 to ASP.NET MVC 2 Beta. I checked the breaking changes but it's not clear where the issue lies. The problem has to do with the default model binder and a model that implements IDataErrorInfo. The property (IDataErrorInfo.Item): public string this[string colum...

ASP.Net MVC Architecture - Location of ViewModels

We have a decent sized MVC project running well at the moment, i've started to look at some re-factoring and I have a question. At the moment the Data Layer and Service Layer is stored in a seperate class library. The controllers load the data objects (generated from linq2sql) from the service layer which does any logic check and then ...

Html ValidationMessage not working since upgrade to ASP.NET MVC 2 Beta

I have an update controller action that checks validation. if (!ModelState.IsValid) return View(InitialiseModel(model)); My view uses UIHelpers: <%=Html.EditorForModel("MyModelTemplate") %> I have a String property in my model called "Title" which has the attribute [Required]: [Required] [DisplayName("Resource title")] public s...

How to add a view for current user details in MVC?

MVC 2, so I do not know if it is different. I am trying to add a page so that when a user is logged in, they click on their username at the upper right of the page, and it takes them to a page showing their details (email, change password link, profile information, etc..). I am trying to use the aspnet MembershipService to do this. ...

ASP.NET MVC 2 Beta single-project Area registration getting HTTP 404

Hello everyone, I'm trying to get ASP.NET MVC 2 single-project area registration to work. Tried with Preview 2 and now with Beta version with no luck. I used the "Add area" dialog to create a "NewsModule" area. Created a NewsModuleController inside it and an Index view for it. The route registration for this Area looks like this: co...

Entity Framework error when submitting empty fields

VS 2010 Beta 2, .NET 4. In my ASP.NET MVC 2 application, when I submit a form to an action method that accepts an object created by the entity framework, I get the following error: Exception Details: System.Data.ConstraintException: This property cannot be set to a null value. Source Error: Line 4500: OnTextChangin...

Call between ambigious RenderActions

I recently uploaded my ASP.NET MVC 2 Preview 2/.NET 4 application (Built using VS 2010 Beta 2) to MaximumASP.com's beta websites and when I try to run it I get the following error: CS0121: The call is ambiguous between the following methods or properties: 'System.Web.Mvc.Html.ChildActionExtensions.RenderAction(System.Web.Mvc.HtmlHelp...

Use Asp.net MVC1 or MVC 2?

A project is due to be started and finished by the end of the year. It's for internal company use, will be entirely done by a single developer(me). I intend to make use of data annotations(via Stephen Walther) and xVal for the first time. It's a 2-3 page web app to collect defect information. It was started in asp.net without a master p...

ASP.Net MVC - Handle Multiple Checkboxes

Ok, I have a role based permission system in place and would like admin's to be able to edit the permissions for each role. To do this I need to load lots of checkboxes, however I'm struggling with getting the return data from the View Please Note: I have looked around, I have found similar questions but as of yet cannot find a solutio...

Strongly typed links in ASP.NET MVC 2.0 beta

With ASP.NET MVC 1.0 I always have been able to generate strongly typed links in my Views using a lambda function: Html.BuildUrlFromExpression<TController>(c => c.Action(arg)); I'm now upgrading to ASP.NET MVC 2.0 beta and I can't find any strongly typed extension for the HtmlHelper (nor the UrlHelper in fact). Have they been replaced...

Which is the best MVC v.2 learning source?

I would appreciate some suggestions about useful sources for learning the new features of MVC v.2 Beta . and the real question is how to learn the features of the MVC 2 before release ? ...

ASP.NET MVC 2 Preview/Beta Visual Studio Questions

ASP.NET MVC 2 Beta was just released and I'm a bit confused as to what is required to run it. Does it require .NET 4? If I have an App that was created using Visual Studio 2010 Beta 2, can I port it to ASP.NET MVC 2 Beta by referencing the proper DLLs? If so what DLLs do I need? Can I run ASP.NET MVC Beta 2 on .NET 4 ready hosting ser...

Problem with DataAnnotationsModelBinder in ASP.NET MVC 2

Everybody tried out a tutorial on DataAnnotations from mvc official website? It didn't work for me. When I'm trying to submit edited product, I have this error message: Method not found: 'System.Collections.Generic.IDictionary`2 System.Web.Mvc.ModelBindingContext.get_ValueProvider()'. I'm using ASP.NET MVC 2 preview 2. Any ideas why this...