Introduction to the ASP.NET Web API

I am a huge fan of Ajax. If you want to create a great experience for the users of your website – regardless of whether you are building an ASP.NET MVC or an ASP.NET Web Forms site — then you need to use Ajax. Otherwise, you are just being cruel to your customers.

We use Ajax extensively in several of the ASP.NET applications that my company, Superexpert.com, builds. We expose data from the server as JSON and use jQuery to retrieve and update that data from the browser. Continue Reading →

Article source: http://feedproxy.google.com/~r/StephenWalther/~3/KKqqBS-mvWE/introduction-to-the-asp-net-web-api.aspx

HTML5 Form Validation

The latest versions of Google Chrome (16+), Mozilla Firefox (8+), and Internet Explorer (10+) all support HTML5 client-side validation. It is time to take HTML5 validation seriously.

The purpose of the blog post is to describe how you can take advantage of HTML5 client-side validation regardless of the type of application that you are building. You learn how to use the HTML5 validation attributes, how to perform custom validation using the JavaScript validation constraint API, and how to simulate HTML5 validation on older browsers by taking advantage of a jQuery plugin. Finally, we discuss the security issues related to using client-side validation. Continue Reading →

Article source: http://feedproxy.google.com/~r/StephenWalther/~3/8RPvFaqnsmg/html5-form-validation.aspx

Metro: Introduction to CSS 3 Grid Layout

The purpose of this blog post is to provide you with a quick introduction to the new W3C CSS 3 Grid Layout standard. You can use CSS Grid Layout in Metro style applications written with JavaScript to lay out the content of an HTML page. CSS Grid Layout provides you with all of the benefits of using HTML tables for layout without requiring you to actually use any HTML table elements. Continue Reading →

Article source: http://feedproxy.google.com/~r/StephenWalther/~3/UXt3Tc7yYsU/metro-introduction-to-css-3-grid-layout.aspx

Simple.Data for Microsoft .NET Data Access Layer

Simple.Data for Microsoft .NET Data Access Layer

I created an internal ASP.NET MVC 3 web application for a client which gave me an opportunity to play with a few technologies outside of my normal toolbox. One of those tools was Simple.Data, which is a simple data access solution good for simple, table-centric, forms-over-data .NET web applications. Normally I would use something like my own ActiveRecord Framework, Castle ActiveRecord, LINQ-To-SQL, or the Enterprise Library Data Access Application Block for such a trivial data access layer, but I enjoy learning new tools and took the opportunity to play with Simple.Data. Overall, I was pretty impressed with the simplicity of Simple.Data when you have a quick forms-over-data ASP.NET MVC Web Application that doesn’t require the sophistication of something like NHibernate, LLBLGenPro, Entity Framework, LINQ-To-SQL or other O/R Mapper. Continue Reading →

Article source: http://www.davidhayden.me:80/blog/simple.data-for-microsoft-.net-data-access-layer

ASP.NET MVC 4 and Entity Framework Database Migrations

ASP.NET MVC 4 and Entity Framework Database Migrations

ASP.NET MVC 4 was released in beta by the Microsoft ASP.NET MVC Developer Team and it comes with a number of really cool features: Bundling and Minification Support of CSS and JavaScript, Database Migrations using Entity Framework 4.3, Web APIs, Mobile Web with support for jQuery Mobile, Real Time Communication via SignalR, and Asynchronous Support. The Database Migrations using Entity Framework Code-First is really cool and is very much like Rails where you can change your code and then via Package Manager add migrations and update your database as your code evolves. Because the EF Migration Files and Configuration get added to your Visual Studio Solution, all the database migration changes get added to source code. Continue Reading →

Article source: http://www.davidhayden.me:80/blog/asp.net-mvc-4-and-entity-framework-database-migrations

ASP.NET MVC 4 Bundling and Minification

ASP.NET MVC 4 Bundling and Minification

ASP.NET MVC 4 provides bundling and minification of CSS and JavaScript, which reduces the number of HTTP Requests and payload size resulting in faster and better performing ASP.NET MVC Websites. There are a number of ways you can reduce and combine the size of CSS and JavaScript using the new feature, and in this ASP.NET MVC 4 Tutorial I want to show how you can create custom bundles where you specify the name and order of CSS and JavaScript Files. In this case, I specify the CSS and JavaScript that is part of Twitter Bootstrap. Don’t forget to also check out my previous ASP.NET MVC 4 Post - ASP.NET MVC 4 and Entity Framework Database Migrations. Continue Reading →

Article source: http://www.davidhayden.me:80/blog/asp.net-mvc-4-bundling-and-minification

ASP.NET MVC 4 Web API Routes and ApiController

ASP.NET MVC 4 Web API Routes and ApiController

ASP.NET MVC 4 Web API Routes and ApiController

This is the 3rd post in a series of ASP.NET MVC 4 Tutorials. The first two posts were on ASP.NET MVC 4 Bundling and Minification and ASP.NET MVC 4 Entity Framework and Data Migrations. In this tutorial I want to briefly look at the new Web API integration in ASP.NET MVC 4. Web API introduces a new route for API calls as well as an ApiController that responds to Get, Post, Put, and Delete requests from REST Clients. Web API introduces formatters that can do content negotiation via XML, JSON, etc. as well as provides better customization of the response using HttpResponseMessage. Continue Reading →

Article source: http://www.davidhayden.me:80/blog/asp.net-mvc-4-web-api-routes-and-apicontroller

ASP.NET MVC 4

ASP.NET MVC 4 - The New Tilde Slash Feature in Razor 2

Razor 2 in ASP.NET MVC 4 has a very subtle enhancement that allows you to dump the old Url.Content(“~/…”) or @Href(“~/…”) when specifying relative paths in your Razor Pages and just use “~/”. This doesn’t seem like much, but it really eliminates a lot of noise in your Razor Views. It also probably cuts down on errors for those in the habit of typing “~/” in their paths anyway forgetting to use Url.Content or something similar. Continue Reading →

Article source: http://www.davidhayden.me:80/blog/asp.net-mvc-4-the-new-tilde-slash-feature-in-razor-2

Firefox 11 Web Developer Tools

Firefox 11 Web Developer Tools

As a web designer and developer who spends his day developing and troubleshooting web designs in ASP.NET Web Pages, ASP.NET MVC, and Orchard CMS, I really appreciate the  web developer tools being integrated into the various browsers. In Firefox 11, Mozilla continues to push the envelope with a new style editor and 3D DOM Viewer. This is in addition to the really nice inspector and JavaScript Scratchpad introduced in the previous version of Firefox. Continue Reading →

Article source: http://www.davidhayden.me:80/blog/firefox-11-web-developer-tools

Creating Custom 404 and Error Pages in Orchard CMS

Creating Custom 404 and Error Pages in Orchard CMS

Creating custom 404 and error pages has changed in Orchard CMS. Prior to Orchard 1.4 we had to modify our web.config files to allow custom errors and then modify the handlers a bit to get Orchard to actually serve our custom pages. Now all we need to do is override a couple of shapes, NotFound.cshtml and ErrorPage.cshtml, and we have custom 404 and error pages in Orchard in seconds. In fact, my custom 404 Error page in Orchard teaches you just that! Continue Reading →

Article source: http://www.davidhayden.me:80/blog/creating-custom-404-and-error-pages-in-orchard-cms