asp.net-mvc

NullReferenceException when testing DefaultModelBinder.

I'm developing a project using BDD/TDD techniques and I'm trying my best to stay the course. A problem I just ran into is unit testing the DefaultModelBinder. I'm using mspec to write my tests. I have a class like this that I want to bind to: public class EmailMessageInput : IMessageInput { public object Recipient ...

Should I unit test the model returned by DefaultModelBinder?

I'm having some trouble unit testing the model returned by DefaultModelBinder. I want to feed in a fake form collection and check the model that it returns to make sure model properties are being bound properly. In my research, I'm not turning up -any- resources on testing the DefaultModelBinder. Maybe I'm missing something. Maybe I shou...

Learn Asp.net MVC 2

I'm Looking for a good project source samples for learning ASP.NET MVC 2. (Full project like CMS, Blog...anything that is well written in MVC2) ...

Losing context from JQuery post with ASP.Net MVC

I have a JQuery dialog box on a page that calls something like this: $.post("/MyController/MyAction", { myKey: key} //... And this successfully gets here: [HttpPost] public ActionResult MyAction(int myKey) { //do some stuff return RedirectToAction("AnotherAction"); } The problem is that the RedirectToAction has no effe...

Membership with Microsoft Access

Hi, I'm doing project in asp.net mvc with Micorsoft Access database and I need to figure out how to make a login system and roles with Microsoft Access. I have seen some examples on the web: http://binarywater.com/OleDbASPNETMembershipProvider.html http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=404 I want to understand if they ar...

better way of showing File Upload Errors?

Model: public class EmailAttachment { public string FileName { get; set; } public string FileType { get; set; } public int FileSize { get; set; } public Stream FileData { get; set; } } public class ContactEmail: IDataErrorInfo { public string Name { get; set; } public string Email { get; se...

Deploy ASP.NET MVC 2 applicatiopn to Windows 2008 R2

Hi, I have a ASP.Net MVC 2 web site, which can be visited by http://localhost/Admin/ContentMgr/ in ASP.Net Development Server from Visual Studio 2010(RTM Retail). When I try to deploy the site to Windows 2008 R2 , IIS 7.5 , the url always return 404. First, my application pool is running on .Net 4.0, and Integration mode. Second, my ...

Linq to Entities custom ordering via position mapping table

Hi, I have a news table and I would like to implement custom ordering. I have done this before via a positional mapping table which has newsIds and a position. I then LEFT OUTER JOIN the position table ON news.newsId = position.itemId with a select case statement CASE WHEN [position] IS NULL THEN 9999 ELSE [position] END and order ...

Scheduler with Asp Mvc

Hi, I want to use a Scheduler like Telerik Scheduler in my Mvc project. The problem is that the Scheduler is a Asp.Net WebForm control. For this reason, I must create a WebForm page in my Mvc project to put the Scheduler control. When I show the page, it work fine to render the layout of the control but if I try to interact with it; c...

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. ...

Asp.net mvc route map problem

I have created a new control VidController public class VidController : Controller { public ActionResult GetVids() { return View(); } } Right clicked inside the method and created View with default name GetVids. Now when i try to open ~/Vid/GetVids there is no page opening... What i hav...

Proper way to validate model in ASP.NET MVC 2 and ViewModel apporach

I am writing an ASP.NET MVC 2 application using NHibernate and repository pattern. I have an assembly that contains my model (business entities), moreover in my web project I want to use flattened objects (possibly with additional properties/logic) as ViewModels. These VMs contain UI-specific metadata (eg. DisplayAttribute used by Html.L...

asp.net-mvc RenderPartial onclick

Greetings, I have an asp.net mvc application. I have some links that corresponds to clients names. When user clicks on this link I would like to show an information of clicked client and additionally a textarea where user shall be able to write some text (comment) about selected client. How can I achieve it? EDIT I've made something li...

C# asp.net MVC: When to update LastActivityDate?

I'm using asp.net mvc and creating a public website. I need to keep track of users that are online. I see that the standard way in asp.net of doing this is to keep track of LastActivityDate. My question is when should I update this? If I update it every time the users clicks somewhere, I will feel a performance draw back. However if I d...

set radio button in jquery dialog

I have the following if/else on another form and it works perfectly. I've now put it on a form which shows as a jquery dialog. Every alert along the way shows the correct assignment, but when the dialog opens, neither button is selected. $("#create-company").click(function() { alert($('#primary_company').val().leng...

The difference between html control and controFor

What is the difference between mvc HTML.Control and ControlFor (TextBox, checkbox etc).. ...

asp.net mvc cookies not persisting on local server (aspnetserve)

Hi. Trying to run an MVC app on the 'portable' web server. Software is aspnetserve. (http://www.ohloh.net/p/aspNETserve) Cookies do not persist. They do fine when I run from visual studio debug. Code is fine, seemingly. Only are dead (fail to persist from page to page) when I use this server. My solution requires deploying a portabl...

Strongly typed controller name in asp.net mvc 2

Hello, Is it possible to use strongly typed controller name and action name in asp.net mvc? for example instead of ActionLink("ActionName", "ControllerName"); somthing like this ActionLink(ControllerName(x=>x.ActionName()), ControllerName) Thanks, Alexander. ...

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 ? ...