model binding

There are 2 entries for the tag model binding

Manipulating Action Method Parameters

During the MVP summit, an attendee asked me for some help with a common scenario common among those building content management systems. He wanted his site to use human friendly URLs.   http://example.com/pages/a-page-about-nothing/ instead of   http://example.com/pages/123/ Notice how the first URL is descriptive whereas the second is not. The first URL contains a URL “slug” while the second one contains the ID for the content, typically associated with the ID in the database. This is easy enough to set up with routing, but there’s a slight twist. He still wanted the action method which...

ASP.NET MVC 2 Optional URL Parameters

If you have a model object with a property named Id, you may have run into an issue where your model state is invalid when binding to that model even though you don’t have an “Id” field in your form. The following scenario should clear up what I mean. Suppose you have the following simple model with two properties. public class Product { public int Id { get; set; } public string Name { get; set; } } And you are creating a view...