Tag: MVC
All the articles with the tag "MVC".
-
Sharpy - an ASP.NET MVC view engine based on Smarty
Are you also one of those ASP.NET MVC developers who prefer a different view engine than the default Webforms view engine available? You tried Spark, NHaml, …? If you are familiar with the PHP world as well, chances are you know Smarty, a great engine for creating views that can easily be read and understood by both developers and designers. And here’s the good news: Sharpy provides the same syntax for ASP.NET MVC! If you want more details on Sharpy, visit Jaco Pretorius’ blog: Here’s a simple example: [code:c#] {master file='~/Views/Shared/Master.sharpy' title='Hello World sample'} <h1>Blog entries</h1>
-
Translating routes (ASP.NET MVC and Webforms)
For one of the first blog posts of the new year, I thought about doing something cool. And being someone working with ASP.NET MVC, I thought about a cool thing related to that: let’s do something with routes! Since System.Web.Routing is not limited to ASP.NET MVC, this post will also play nice with ASP.NET Webforms. But what’s the cool thing? How about… translating route values?
-
Ordering fields in ASP.NET MVC 2 templated helpers
Ever worked with the templated helpers provided by ASP.NET MVC 2? Templated helpers provide a way to automatically build UI based on a data model that is marked with attributes defined in the System.ComponentModel.DataAnnotations namespace. For example, a property in the model can be decorated with the attribute [DisplayFormat(DataFormatString = "{0:c}")], and the templated helpers will always render this field formatted as currency. If you have worked with templated helpers, you must agree: they can be useful! There’s one thing which is impossible in the current version: ordering fields. Take the following class and the rendered form using templated helpers: [code:c#]
-
Vote to help me speak at the MIX 2010 conference!
Everybody knows the Microsoft MIX event, right? The one in Las Vegas? The one with all the fancy web-related stuff? Rings a bell? Ok, great. In the beginning of December 2009, Microsoft did an open call for speakers, which I answered with some session proposals. Who doesn’t want to go to Vegas, right? The open call proposals have been processed (150+ sessions submitted, wow!) and a voting has started. Yes, you hear me coming: please go ahead and vote for a session I submitted. Voting ends January 15th, 2010. Since I could not decide which color of the voting banner matched best with my blog’s theme, I decided to put them all three online: Thanks in advance! PS: There's also Elijah Manor, Justin Etheredge, K. Scott Allen, and many others who submitted good looking sessions.
-
Supporting multiple submit buttons on an ASP.NET MVC view
A while ago, I was asked for advice on how to support multiple submit buttons in an ASP.NET MVC application, preferably without using any JavaScript. The idea was that a form could contain more than one submit button issuing a form post to a different controller action. The above situation can be solved in many ways, one a bit cleaner than the other. For example, one could post the form back to one action method and determine which method should be called from that action method. Good solution, however: not standardized within a project and just not that maintainable… A better solution in this case was to create an ActionNameSelectorAttribute.
-
Microsoft PDC09 keynote highlights
Finally found some time to write a short blog post on the announcements this morning at PDC 2009. Ray Ozzie started the keynote this morning, focusing on Microsoft’s “three-screen” vision for the future. There will be three screens connected to the cloud: TV, (handheld) devices and of course good old PC. This vision is driven by some key players: Windows 7, Internet Explorer, Silverlight and Windows Azure. Make sure to have a look at these four if you want to play in this future. Some announcements were made as well:
-
Localize ASP.NET MVC 2 DataAnnotations validation messages
Living in a country where there are there are three languages being used, almost every application you work on requires some form of localization. In an earlier blog post, I already mentioned ASP.NET MVC 2’s DataAnnotations support for doing model validation. Ever since, I was wondering if it would be possible to use resource files or something to do localization of error messages, since every example that could be found on the Internet looks something like this: [code:c#] [MetadataType(typeof(PersonBuddy))] public class Person { public string Name { get; set; } public string Email { get; set; } } public class PersonBuddy { [Required(ErrorMessage = "Name is required.")] public string Name { get; set; }
-
Recording of my session at Remix 2009 - ASP.NET MVC
On September 29, I did a session on ASP.NET MVC at Remix 2009 Belgium. All session recordings are now online, check the Remix09 site. Slides and code for my talk can be found in a previous blog post. The video material can be found below. Enjoy! And feel free to leave some comments! Abstract: "Building a Twitter clone in 60 minutes, featuring what's new in ASP.NET MVC 2 preview 1 and focusing on some of the core ASP.NET MVC features like security and routing."
-
Let me Bing that for you
Have you ever been bugged with stupid questions? Do you get tired of people asking stuff that is only one search engine query away? Chances are you answered both of these questions with “yes!”. Together with Phil Haack and Juliën Hanssens, I created LetMeBingThatForYou.com, a website that generates a search engine query for people who ask you questions they could easily answer by themselves. One last note: this project is not associated with Microsoft nor Bing. We’re doing this project for fun.
-
Leveraging ASP.NET MVC 2 futures “ViewState”
Let’s start this blog post with a confession: yes, I abused a feature in the ASP.NET MVC 2 futures assembly to fire up discussion. In my previous blog post, I called something “ViewState in MVC” while it is not really ViewState. To be honest, I did this on purpose, wanting to see people discuss this possibly new feature in MVC 2. Discussion started quite fast: most people do not like the word ViewState, especially when it is linked to ASP.NET MVC. As Phil Haack pointed out in a comment on my previous blog post, I used this foul word where it was not appropriate. (…) I think calling it ViewState is very misleading. (…) what your serializing is the state of the Model, not the View. (…)