Why Lightswitch 2013?
1.Website/Application is Responsive , that means it support responsive design- Support all device from desktop , tablet to mobile etc.2.Seamless support to Html5 , JavaScript and MVC hence make it more compliant to cross browser compatible.
3.More suitable for Admin Module where View, Add, Edit, Update and Delete functionality with ease to achieve with inbuilt wizard .
4.Easy to customize as per business requirement.
Customize Html5 using Web API.
LightSwitch Screen Designer helps to create master-detail screens by which you can add/edit the screen details. But some time we have requirement not to use lightswitch traditional ‘Save’ button and we need custom button to update record with custom value that time we can use Web API which will call through custom button on the detail screen.
Let have an example, suppose we have master-detail screen for Employee and EmployeeDetails;
When user click on one of the employee ‘Add/Edit Employee Details’ screen gets open as follows;
As you can see, we have to use
button to save the record, but some time we need to call store procedure to update/insert records in the database as per business requirement, that time we need to have new custom button and custom code to call the update for the above form;
button to save the record, but some time we need to call store procedure to update/insert records in the database as per business requirement, that time we need to have new custom button and custom code to call the update for the above form;
Let’s say we need new button to ‘Resend’ and ‘Cancel’ the information, so we will add 2 buttons to above form and we will change the edit screen behavior to Browse as follows;


So in above screen we have disabled the Save button which comes with Edit behavior and added custom buttons ‘Resend’ and ‘Cancel’, so we need code to call store procedure;
Right click on the button and select ‘Edit Execute Code’ to add our custom code in the same screenName.lsml.js file;
Call store procedure using Jquery JSON as follows;
Here I have created new folder ‘api’ in Server project and added new class file ‘EmployeeDetailsController.cs’ and added following code;
So by adding customization with Web API we can achieve to call store procedure as per business requirement.





No comments:
Post a Comment