Html.ActionLink and HTTP PUT, DELETE verbs
Recently I was developing an ASP.NET MVC application in which I needed to create clickable images that would make it possible to delete items and/or to switch an items state between activated/deactivated. I wanted to solve this by using controller methods that would be decorated with an [HttpDelete] or [HttpPut] attribute (delete and put http verbs). Creating the controller methods was straightforward, but I needed to add some html to my view to have the url submitted/posted with the correct http verb (delete or put). Ideally I would want to use Html.ActionLink for this, but unfortunatelly it doesn't support clickable images (only '<a href=...'), and it also does not support other http verbs then 'get'. I have created an HTML helper class, with some HTML extension methods, to make it easier to add clickable put/delete images to views, which I will describe in this post.
ASP.Net MVC and RegisterClientScriptInclude
I like developing with ASP.Net MVC, but there's one functionality that I really miss, compared to ASP.Net Web Forms. In Web Forms you can use The RegisterClientScriptInclude and RegisterClientScriptBlock methods of the ClientScriptManager class, to register JavaScript includes / blocks of JavaScript code, to the head element of the generated HTML (from within code, aspx, ascx, etc.). I have found a way to accomplish the same with ASP.Net MVC, which I will describe in this post.