Wednesday, 26 March 2014

Format date on textbox in Lightswitch HTML client

The HTML client for Ligthswitch is nice, except that not everything is that easy to obtain as in the Silverlight version. So is formatting dates on 'view' screens. Despite setting it at the entity in the 'Server' part of the project, it doesn't show up on the HTML output.
Add a 'postRender' script to the date field(s) you like to format.

  • Therefore, go to the (view)screen where you like to format the date.
  • Select the field which shows a date. Let say 'StartDate'.
  • Click on 'Write code' on top of the window and select 'StartDate_postRender'.
  • Add the following piece of code:

myapp.ViewProject.StartDate_postRender = function (element, contentItem) {
    // Write code here.
    contentItem.dataBind("value", function (value) {
        if (value) {



Kerry Schultz said...

It's really productive, you started to blog solutions of your daily problems... gives me an idea of my own!! Also what if the same problem occurs with the windows?

zafaranhachmeister said...

Betfred Casino & Hotel - Mapyro
Betfred Casino & Hotel 평택 출장안마 is a hotel 용인 출장마사지 on the Betfair boardwalk in the 인천광역 출장안마 Greater London Area. Built in 1946, 용인 출장안마 this hotel is 1.9 mi (2.5 km) from the 전라남도 출장안마