Search code examples
lightswitch-2013

Adding a back button in a LightSwitch details page


I have created my screens using the 'common screen set' template option.

From the details page I have a button to edit the details. I need to add a back button (which redirect to browse page/previous page) near to the edit button.

How can I do this?

enter image description here


Solution

  • If your going back to a browse screen, you would simply create a new button, and add this code to "Edit Execute Code"

    myapp.BrowseScreen.Back_execute = function (screen) {
        myapp.showBrowseOrders();
    };
    

    alternatively if you add a button, and you select the browse screen from the Tab list, this will also re-direct you to a browse screen.

    in terms of going to the previous page, I would use myapp.commitChanges(); this would save the changes on the screen from a custom save button created by you (validation can be added on here), or alternatively you can use myapp.cancelChanges(); which also navigates back but no changes will be saved. Both of these commands above would take you back to the previous page.