How-to localize jQuery UI Datepicker within ASP.NET MVC site

JQuery’s date picker UI component is very easy to localize on Javascript level. On this blog post I’ll describe how to ensure that date picker culture follows site’s server side culture. This is pretty trivial to accomplish, but it won’t hurt to document it here. First, you need to pick the translations you need from jQuery UI trunk. Place these files on your script folder and include them on your page (or master page), here I’m using my favorite static content bundler SquishIt to combine and minify scripts: ...

May 16, 2011 · 1 min · Tero Teelahti

Disable submit buttons on form submit with jQuery.validate and ASP.NET MVC 2

I had a very common requirement to fill: when user clicks form submit button (or enter on keyboard) the button needs to be disabled in order to prevent double submits. Double submits could of course be filtered at server side with various timestamp mechanisms, but this was not what I was after this time. The first option that came into my mind was of course just to subscribe into form submit and disable buttons there like this: ...

April 29, 2011 · 2 min · Tero Teelahti

Applying zebra striping with jQuery tablesorter and tablesorterPager plugin

A small but annoying bug I found today (and seems that someone else is having the same problem): when using jQuery.tablesorter) plugin together with tablesorterPager, applying the pager clears some properties from the table; In this case namely zebra striping. After initialization first table page is not striped, but next ones are after the first table page change. I found some crazy complex solutions, like creating new widgets to replace the built in “zebra”, but the good enough solution ended up being lot easier: asking tablesorter to reapply widget: ...

March 3, 2011 · 1 min · Tero Teelahti