Injecting Custom HTML Attributes in ASP.NET MVC

Recently Stuart Leeks and I have developed a worrying pattern of having the same ideas at the same time. I’m starting to doubt we’re different people. Except he’s about a foot taller so maybe that’s aspirational from my side. Our latest coinciding of ideas was a way to automatically inject HTML attributes for fields rendered…

1

Templated Razor Delegates combined with Partial Views

I was with a customer in Germany this week, and just before I left one of the (rather talented I might say) developers asked me about passing markup into an HtmlHelper extension. It turns out this is pretty easy, as covered by Phil Haack under Templated Razor Delegates. However, I particularly like keeping my HTML…

0

Mvc.ValidationTookit Alpha Release: Conditional Validation with MVC 3

Update: I’ve not forgotten about this everyone, apologies for the delay. My attempt to get approval to publish failed due to vacations (mine and others) so as soon as I can I’ll try again. My blog posts on doing conditional validation in MVC have always been popular, and I’m frequently surprised by where I find…

16

Immersive MVC and jQuery: Project Silk

Patterns and Practices have just released their latest round of guidance for developing web applications – “Project Silk”. I’ve been watching what they generate closely and I think you’ll be impressed. To quote the landing page; “Project Silk provides guidance for building maintainable cross-browser web applications that are characterized by an intentional design, rich interactivity,…

0

Project Silk: Patterns and Practices do Rich Web Apps

My blog has been quiet of late – because our team is busy I think. We’re recruiting by the way Something I’ve been wanting to blog about for a while now is “Project Silk”. This is Patterns & Practices latest round of web development guidance. Karl Shifflett  is the man at the wheel, so be…

1

Detecting which button was clicked in MVC

I’ve seen a few hacks in the past to try and work out which button caused a form POST in ASP.NET MVC, but the truth is it is pretty easy. Step 1: Inside your form, add two Submit buttons. Add a name attribute to both (note it isn’t added by MVC by default); 1: <p>…

8

Conditional Validation in ASP.NET MVC 3

Update: If you like this, you’ll like Mvc.ValidationTookit even more – check out this post! Some time ago I blogged on Conditional Validation in MVC, and Adding Client-Side Script to an MVC Conditional Validator. A number of people have asked me to update the sample to MVC 3, so guess what – it’s your birthday!…

27

ASP.NET MVC 3 Optional Parameter Routing Issue

Update: Phil Haack has now blogged on this under Routing Regression With Two Consecutive Optional Parameters. When upgrading the Labs and Demo code for a course I run from MVC 2 to MVC 3 I discovered some odd behaviour with one of the routes. We  have a very simple route to handle an “archive” page…

4

Unit Testing ASP.NET MVC Routes

Two things I always encourage customers to do are; Always delete the default route pattern after a File –> New project. This helps you focus on designing your routes throughout your site, and helps reduce SEO-unfriendly routes etc. Always unit test your routing table. For number two, this is because it is so easy to…

1

View Model versus Domain Entity Validation with MVC

I blogged way back in January about what I see as the three variants of View Model usage in ASP.NET MVC. If you’ve not read that post, check it out here and report back! The Problem What I’ve started to see is that many other developers like my approach of defaulting to Variant 2 (a…

3