When using MVC and converting your data into ViewModels which is the accepted way to do this?
At the moment I'm using AutoMapper to do this and its working well. However I did see in a blog article (I think it was Rob C) having a constructor on the ViewModel which takes the number of required params and then generates the ViewModel
Eg ...
When I migrated sample SportsStore app from Steve Sanderson's Pro ASP.NET MVC Framework (from asp.net 1.0 to mvc 2 beta) using this app provided by eric lipton, everything work just fine - except 2 unit tests.
The error message on both is:
Tests.CartControllerTests.VeryLongTestMethodName:
System.ArgumentNullException: value can't be unde...
I've been following this guide from MSDN about "Creating an ASP.NET MVC Areas Application Using Multiple Projects". Since ASP.NET MVC 2.0 is just preview one would imagine there to be some bugs.
My problem is, it simply doesn't work! At least not the way it's suppose to. After setting everything up and pressing F5, one would think that,...
I dont think i quite get the Ajax functions in mvc, because i get this wierd problem.
I got the following code which makes my ajax call, it is placed in a partial view with a productList:
<% using(Ajax.BeginForm("AddToBasket", "Basket",
new { productID = item.Id },
...
This question is different from the others because all of the questions I've seen so far are talking about the database. I understand the database side of multitenacy, but I'm not 100% sure on the way to do the front end.
I'm working on the design for a product that will basically be a hosted service for customers. As far as the multite...
I read a lot of post, and i dont see my mystake.
Can some body help me please.
There is my global.asax
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", ...
I've been trying to get nunit 2.5 to work with mvc 2 (VS2008) after following some guides and updating registries. I though I was done. I can select nunit when choosing my testing frame work but there is no test project created. When I create a new mvcapplication.nunit.tests template it fails with the error.
Error: this template atte...
Hi all,
What are the best usage of the following resource files.
Properties -> Resources (Phil used this resource for localization in DataAnnotation)
App_GlobalResources folder
App_LocalResources folder
I also would like to know what is the difference between (1) and (2) in asp.net mvc application.
Thanks,
Soe Moe
...
My model has a property of "output" and my form has a TextBox named "output", both spelled exactly the same. When I fill out the form and post it, the returning view has unexpected results.
Specifically, I receive the posted "output" form variable which is then bound to my Model in the Controller Method, then I change this variable to ...
I'm using a generated class as a model, and I wish to add DataAnnotation attributes to some of its properties. As it's a generated code, I don't want to add the annotations directly. Is there another way to attach them to a property?
I'd considered making the model an interface, and using a partial class to get the generated class to su...
I am having trouble upgrading my current project to use RIA Services. I added all the necessary web.config changes but still no luck. I everything compiles fine but when I hit the page using the datacontext I get an error. I debugged with fiddler and I'm getting a 404 on one of the request. I am getting back headers in my grid so some co...
I have a basic MVC 2 beta app where I am trying to implement a custom Identity and Principal classes.
I have created my classes that implement the IIdentity and IPrincipal interfaces, instantiated them and then assigned the CustomPrincipal object to my Context.User in Application_AuthenticateRequest of the Global.asax.
This all succeed...
I'm trying to read buddy class metadata information for usage outside of the normal asp.net mvc 2 validation process. I thought it would be as simple as saying:
DataAnnotationsModelMetadataProvider metadataProvider = new DataAnnotationsModelMetadataProvider();
var metaData = metadataProvider.GetMetadataForType(() => new T(), typeof (T...
I've got a model with a DateOfBirth property on it, and in the view that uses that model, I've got a textbox:
Html.TextBox("DateOfBirth")
I'm using DataAnnotations on the model, and validation works properly, and the textbox's value is loaded from the model. However, I don't want that value to be what is initially displayed, but rathe...
I'm trying to get setup using the DataAnnotations validator in ASP.Net MVC 2.0 Beta, but with the following model:
public class Foo {
[Required] public string Bar {get;set;}
}
And the following code in my view:
<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<Foo>" %>
<!-- later on -->
<% Html.EnableClientVa...
Hi
I have been following this tutorial:
http://msdn.microsoft.com/en-us/library/ee307987(VS.100).aspx#registering_routes_in_account_and_store_areas
and have an application (a bit more complex) like this set up. All the areas are working fine, however I have noticed that if I change the project name of the Accounts project to say Areas...
I have an ASP.NET MVC 2 Beta app and have set <MvcBuildViews>true</MvcBuildViews>
in the property group at the top of my csproj file. But my views are not being compiled. A closer look at the .csproj file shows a squiggly under the MvcBuildViews tag and when I hover over it, it says
The element 'PropertyGroup'
in namespace
'htt...
I have a VPS and I would like to be able to run ASP.NET MVC 2 apps that were built in Visual Studio 2010 Beta 2.
Which ASP.NET MVC 2 do I need to install (is it Preview 2?) and where can I get the installer for it since all I can find are MVC 2 RC for VS 2008?
...
Is there a good full sample application which highlights the new features of ASP.NET MVC v2 (as opposed to the initial release of ASP.NET MVC)?
...
Is there a generic Html.Element?
I would like to be able to do this:
Html.Element<AccountController>("IFrame", "elementName", new { src = c => c.ChangePassword })
...