The design of SharpTiles and it's syntax if based on the following principles:


Don't Repeat Yourself
Microsoft did a great job with C# 3.5. The syntax was enriched with the var statement, property initializer, collection initializer, extension methods and Linq. All syntax enhancements for reducing the repetition and plumbing in your code. The .aspx syntax has fallen behind. As far as I'm concerned I'm just rendering HTML. This is especially the case when doing MVC, but I have to add information about base pages, code files, base classes, imported namespaces, my own assembly and a third party assemblies with a very specific PublicKeyToken.

1:<%@ Page Language="C#"
           Inherits="SomePage" %>
2:<%@ Import namespace="My.Business"%>
3:<%@ Register TagPrefix="3dtxt"
      Assembly="ThirdParty.WebUI.WebDataInput.v4.2, Version=4.2.20042.32,
      Culture=neutral, PublicKeyToken=324dfdsf234"%>
4:<%@ Register Assembly="My.Web.UI" Namespace="My.Web.UI" TagPrefix="myweb" %>

And for each new .aspx file I probably repeat 80% of this stuff. In SharpTiles taglibs are registered in code only once. After registering, the tags are available throughout all tiles and there is no need for registering assemblies in each file. Therefore lines 3 and 4 aren't required, furthermore a tile doesn't have a code behind. It's just a template without any knowledge of the business layer (loosely coupled). As a result there is no need for the import and description of the base class and code file and no need for line 1 and 2.

Inverse of Control

Reuse of components must be stimulated. How does Sharptile accomplishes this? Take another look at the previous code example and notice the MasterPageFile declaration. By declaring the master page file you prohibit yourself to use this page with a different master. What if I want to use my page on a participant portal and an administrator portal? Well you better do some nice stuff in your base page.

So why not use a UserControl? Well they aren't that bad but you will have a tight relation between parent and user control. For example you have one page which could show a bar graph or pie charts for some data depending on the picked menu item. So you basically want to slide in a different control for rendering the data. But what you end up doing is placing both controls in the page and disabling one or the other. Switching between the user controls is now page logic. Wouldn't it be nice to just configure this? It would definitely save you a couple lines of code. Dynamically loading UserControls is also an option but it has the same problem.

SharpTiles solves this by inversing and decoupling the encapsulation of controls. With the Tiles concept you have small building blocks (your tiles) and a definition file stating how your page is built up. See the following Java Tiles example

  <definition name="main" template="/layout/main.jsp">
    <put-attribute name="header" value="/jspf/header.jsp"/>
    <put-attribute name="menu" value="/jspf/menu.jsp"/>

  <definition name="participant.portal" extends="main">
    <put-attribute name="body" value="/jspf/participant/portal.jsp"/>

IoC containers solve the same kind of problem. The SharpTiles template engine supports tiles. The Tiles concept is adopted from the Java Tiles framework project.

Light weight

No heavy code base should be required. We want to be able to render html in a simple way. For rendering the SharpTagLib (based on JSTL) syntax is used. This provides a good balance between the amount of code and the available tags and their functionality.

Tiles don't require compilation. They are parsed and cached at first use. The SharpTiles framework will allow changing of definitions, tiles and resources while running the application as of Milestone 4. At this point only refreshing of tiles is implemented.


This is a big thing. Aspx files and their code behind are not very willing to volunteer as test subjects. Mocking the HttpRequest, HttpResponse and or HttpContext isn't done easily and isn't pretty. Therefore you can run the SharpTiles template engine stand alone. Together with the Tiles concept this should allow you to narrow down your html render tests to small modular pieces. For integration test I refer to WatiN

As a matter of fact SharpTiles is developed with the TDD paradigm. With each binary download you get a test and a coverage report.

Contact form fixed

I regret reporting that the contact form was broken for the last week. All mails send to us were corrupted(empty). So reported bugs in the last week are not received. I'm aware that the timing with regards to the monorail release isn't very handy. The contact form is fixed now. I apologize.

4 February, 2010

Monorail released M5

Monorail is released. The release also contains some minor fixes.

23 January, 2010

Monorail almost finished

Maikel Willemse is coding a Monorail view engine. It's available in the nightly release. A tutorial and a new release will be available shortly.

2 January, 2010

No more tiles.xml
(if you like)

A NSTL view engine is now available. You can do SharpTiles without having a tiles.xml. You will lose the power of dependency injection. If you are interested check out the tutorial page.

21 July, 2009

Developer M3 released

Fixed a couple of parse bugs. Cleaned up refreshing of resources, resource locations and registration of the TilesViewEngine. Wrote some tutorials
Ronald Dehuysser contributed the <tiles:insertTemplate/> and <tiles:putAttribute/> tag.

8 June, 2009

HtmlHelper wrapped II

Updated tag reference documentation.

5 April, 2009

Ready for MVC RC 2

SharpTiles is now ready to use with MVC RC 2.

6 March, 2009

HtmlHelper wrapped

The MVC HtmlHelper is now wrapped and can be used. For it's only available in the nightly build. When the documentation and new Tutorials are made a new release will be made.

22 December, 2008

Ready for Beta 1

SharpTiles is now ready to use with MVC Beta 1. The tutorial page will be updated soon.

3 November, 2008

We've got Tiles

It took me a bit longer than expected but Milestone 1 is reached. Tiles are now available.

23 July, 2008

First release

Finally, after some hard work my pet project is ready for its initial release. Here it is! Please give it some thoughts and feel free to add comments.

23 May, 2008

SID: PopUp 0