Blog

Chan : Chan 0.9 Tech Preview is here, as in right here.

11 Jan 2010 | 2 Comments | Permalink

Cyclomedia.co.uk - always believing that the chef should taste his own soup - has been converted to a bleeding edge Chan 0.9 build. Obviously work is not nearly finished, specifically in matching the HTML5 form validation sensibilities with Chan's own but some of the experience will be helpful to future developments. By far the oddest sensation was found when converting a few things to use the new MVC-ish square bracket notation. For example, whilst previously to use one of Chan's built in Icons you had to create an Image control and assign it's Path property like this:

<Chan:Image runat="server" Path="[Icon.Link]" />
	

... probably creating a whole load of ASP.Net reflection and memory overhead on the server in the process ... You can now just do this:

<img src="[Icon.Link]">
	

Entering this in raw HTML and magically having a fully configured and correctly pointed path to a PNG magically pop out of the renderer is actually a little unnerving when you're not used to it! What's more fun is that the code that performs this neat trick parses the HTML in a stream as it is output to the client meaning you can stuff these square brackets nearly anywhere. This is used internally by Chan to surpass the old Region system, whenever you bind a Panel or Fragment to a region it attaches itself to the Renderer and waits until it is asked for its HTML. whereas the pre 0.9 builds had a list of regions that had to be created and pre-filled prior to rendering, creating a lot of strings floating about in RAM.

Something that attaches itself to the Renderer and swaps out square-bracketted snippets for HTML is called a Resolver and you can easily create your own - It's a public interface with just one function. So you could have a resolver that responds to "[Foo]" with "The anwser is [Bar]" and another that resolves "[Bar]" to "42". Stick "[Foo]" somewhere in your ASPX, HTML or even the Text property of a Control and the renderer won't even break a sweat; the client will see "The answer is 42" in its place.

Anyway, as you can no doubt see it doesnt LOOK much different around here, esp considering that said Chan Reference pages are still only at 0.85. The trick is to view the pages in Opera and see the HTML5 Date and Number input types automagically appear...

Recent Posts