Home > Web Camp > JQuery template

JQuery template

One of the coolest thing in “Race day commander” application is the use of JQuery template. In fact in our work place we have been using the open source “Jtemplate” plugin for quite sometime and it is a a great templating plugin. But at the #webcamp James Senior told us about the microsoft JQuery template and it was fun to use it.

The plugin is available at http://github.com/nje/jquery-tmpl and of course to learn it refer to Scott Gu’s blog.

For us, it was literally changing the ‘#’ character to ‘{‘ and hit refresh :-).

For Example in JTemplate it is:-

<div>
{# CommentText.substr(0,250) }
{#if CommentText.length > 250}<span>… more</span>
{#/if}
</div>

And in JQuery template it would be:-

<div>
{{= CommentText.substr(0,250) }}
{{if CommentText.length > 250}}<span>… more</span>
{{/if}}
</div>

This is really a cool way of making your page interactive and implementing “progressive disclosure” logic by having a template in the page and return tiny json objects and is not limited to ASP.NET MVC, in fact I use it a lot in my webforms which still have UpdatePanels ( Urrggghhh !!! )

About these ads
  1. No comments yet.
  1. March 3, 2011 at 8:02 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 42 other followers

%d bloggers like this: