2014年4月15日 星期二

LightSwitch – Custom Code on HTMLClient, Visual Studio 2013

Custom Code on HTMLClient

There are 4 types allow us to write custom code

image

 

No worry, LightSwitch has loaded following libraries for us

image

 

Example 1: Add default value of input field, Address1

Write code on created method of field Address1

image

 

Input following code in .lsml.js file, assign default value if Address1 is empty

image

 

The result is like below

image

 

Example 2: Show image/picture on screen

1. Click button, Add Data Item

2. Choose Local Property (can leave default Type = String)

3. Name it, Logo, as example

image

 

1. Drag & drop Logo into the place that you want to display

2. Change its Type to Custom Control

image

 

Write code within Logo_render method

image

 

Append <img> tag and given correct src attribute

image

 

The result is like below

image

沒有留言:

張貼留言