asp.net-mvc-2

MVC2 Areas and unit testing for routes

Hello, I want to test my routes in unit tests. But Areas is not working in my unit tests. Is it possible to test ASP.NET MVC 2 routes for Areas? I am using this code [SetUp] public void SetUp() { this.routes = new RouteCollection(); MvcApplication.RegisterRoutes(this.routes); } #endregion private ...

ASP.NET MVC 2 "value" in IsValid override in DataAnnotation attribute passed is null, when incorrect date is submitted.

Hello to all! This is my first question here on stack overflow. i need help on a problem i encountered during an ASP.NET MVC2 project i am currently working on. I should note that I'm relatively new to MVC design, so pls bear my ignorance. Here goes : I have a regular form on which various details about a person are shown. One of them is...

Using Linq to SQL change events with attribute-based mapping

I'm writing a new ASP.NET MVC2 application using Linq to SQL. This application depends on an existing SQL database. I am using attribute-based mapping to map my database fields to my Linq to SQL entities. I also need to make use of Linq to SQL's On[Property]Changed methods so I can perform change-auditing of database tables within my a...

What Controller/Action will this go to?

Assume this is the first route entry: routes.MapRoute( "myRoute", "employees/{city}/{pageNumber}", new { controller="Employees", action = "List", pageNumber = 1 } ); If I make the following request employees/london/2 it gets matched to the following action method: public ActionResult List(string city) {} How did that happe...

ASP.NET MVC Catch All

The ignore route is defined like this: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Why not routes.IgnoreRoute("{resource}.axd/{*}"); What is the significance of pathInfo? Thanks. ...

Confusion about Mono?

Ok, so I was perusing the mono site and noticed there are Novell tools I can purchase for Visual Studio that will let me choose to compile in Mono? My confusion is, if I am using a tool set such as MVC 2 and other Frameworks, and I use those tools to compile to mono, how exactly does that play into things? I mean don't those tool sets ...

Why isn't ASP.NET MVC 2.0 part of the .NET 4.0 BCL ?

Why isn't ASP.NET MVC 2.0 part of the .NET 4.0 BCL ? ...

ASP.NET MVC/LINQ: What's the proper way to iterate through a Linq.EntitySet in a View?

OK so I have a strongly-typed Customer "Details" view that takes a Customer object Model. I am using LINQ to SQL and every Customer can have multiple (parking) Spaces. This is a FK relationship in the database so my LINQ-generated Customer model has a "Spaces" collection. Great! Here is a code snippet from my CustomerRepository where ...

ASP.NET MVC 2 book recommendations

I know a bit of MVC, I want to start a project in MVC 2 and a good book would be really helpful. MVC 2 is though really young, so not a lot of books have come out for it. Have you read any ASP.NET MVC 2 book? If so, how was it? ...

Different controllers with the same name in two different areas results in a routing conflict

I have two areas: ControlPanel and Patients. Both have a controller called ProblemsController that are similar in name only. The desired results would be routes that yield /controlpanel/problems => MyApp.Areas.ControlPanel.Controllers.ProblemsController and /patients/problems => MyApp.Areas.Patients.Controllers.ProblemsController. Ea...

Data Annotations for validation, at least one required field?

If I have a search object with a list of fields, can I, using the System.ComponentModel.DataAnnotations namespace, set it up to validate that at least one of the fields in the search is not null or empty? i.e All the fields are optional but at least one should always be entered. ...

How to output error messages to jqueryUI dialog in mvc?

I have a partial view that is being displayed as dialog. I need to do validation in my controller and return the error message in the dialog. How can I do that? part of my code in the controller is as follows: if (!String.Equals(newPassword, confirmPassword, StringComparison.Ordinal)) { ModelState.AddModelError("Co...

Navigating back to "Home" from an area (MVC2)

I have a few areas in my application that are relatively independent (all navigated to from the master page). So, as of now, I am simply using the "default" MVC2 template (the one you get when you create a new MVC2 project). So the menu looks like this: HOME AREA1 AREA2 AREA3 AREA4 .... ABOUT Now, when I first load up the page, I am on...

custom httphandler in asp.net cannot get request querystring?

i've been trying to get this to work. its basicly a way to have certain MVC pages work within a webforms cms (umbraco) someone tried it before me and had issues with MVC2.0 (see here), i read the post, did what was announced there, but with or without that code, i seem to get stuck on a different matter. it seems like, if i call an url...

HTTPContext issues (ASP.NET MVC2)

Hey guys, this is a weird one! I have a site that I have deployed in 3 places. 1. My local machine. 2. Dev Server 3.QA Server. My project runs on my machine and the dev server. On the QA server, it runs, but the HTTPContext object is blank (not pulling from AD, etc). All 3 machines live on the domain. The Dev Server and QA Server are ...

How to use IN operator in Linq?

Query: Select * from pu_Products where Part_Number in ('031832','027861', '028020', '033378') and User_Id = 50 and Is_Deleted = 0 The above mentioned query is in SQL and i need the query might be converted into Linq. Is there any option using the "IN" operator in Linq?. can you convert above mentioned query into Linq? ...

ASP.Net MVC2 Securing the site via tokens and whatnot

I am trying to use MVC 2 as a middle layer for my iPhone app. The basic principal here is the MVC site will expose APIs that will allow users to POST data from iPhone and GET data from sql database running behind MVC app. The MVC 2 project will facilitate to and fro logic. I have few questions regarding that... 1. What is the best way o...

ASP.NET MVC Page - Viewstate for Confirm email field is getting erased on Registration Page if validation fails

Hi I have a Registaration page with the following fields Email, Confirm Email, Password and Confrim Password. On Register Button click and post the model to the server, the Model validates and if that Email is already Registered, it displays the Validation Error Message "User already Exists. Please Login or Register with a different e...

Unit testing ASP.NET MVC 2 routes with areas bails out on AreaRegistration.RegisterAllAreas()

I'm unit testing my routes in ASP.NET MVC 2. I'm using MSTest and I'm using areas as well. [TestClass] public class RouteRegistrarTests { [ClassInitialize] public static void ClassInitialize(TestContext testContext) { RouteTable.Routes.Clear(); RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); ...

ASP.NET MVC2 - Does Html.EditorForModel() work on the nested data model?

My test shows it doesn't work. It ignores the nested data in model. Can anyone confirm this? ...