save method on screen never gets called


  • I've created a HTML screen and in the Write Code option I've selected "created" and put in my necessary initialisation code, this works fine.

    I have then tried to implement the "save" option, which according to the tooltip "Called on screen save. Runs on the client."

    I can not seem to get any code within this method to run, it does not appear to be called.  Looking through the msls-1.0.0.js I cannot see any code which would call this.  I need to navigate to another screen when this screen is saved, how would I achieve this as it looks like there's missing functionality here.

    Thursday, December 13, 2012 4:20 PM

All replies

  • Duncan, thanks for reporting this!

    This is an issue (known to LS team) with this Preview release.  This "save" menu item under write code I believe should not of been there in the Preview.

    If you are blocked (specific functionality you need) by this please let me know.  


    Robert Schoen (Microsoft Visual Studio LightSwitch Team)

    Thursday, December 13, 2012 10:26 PM
  • Hi Robert,

    Like I said, I'm trying to navigate to another screen when this screen is saved.  This is an "add" screen for which some code runs on the server side Inserted method, so I need to redirect to the full edit page once inserted.

    With the Silverlight client, I could add in a button, style it to look like a save button and have that call SaveChanges follow by performing the navigation. I assume that with the HTML client I can add the same button, but it won't appear/look like the standard save button, leading to a change in how the UI flows.


    Friday, December 14, 2012 9:40 AM
  • Hi Duncan,

    This is indeed an interesting scenario. We are currently finishing our APIs. One of the events we added is afterClose which allows you to navigate to another screen as soon as the current screen is saved and closed. This event will allow you to do exactly what you want. Unfortunately I do not have an easy solution for you now, so stay tuned for the next release.


    Wednesday, December 19, 2012 8:04 AM
  • Duncan,

    Can you try the following and see if this will meet your needs?  On your "Add Screen" that is opened in the designer, try to "Add Layout Item..." and select "Button".  In the "Add Button" dialog, select "Choose an existing method" option and in the first dropdown, select the "full edit page" for your navigation - and then for the "Task" select "Save".  

    After completing the above, you should have a "Button" that will trigger a save and also navigation back to the screen that you want...


    Robert Schoen (Microsoft Visual Studio LightSwitch Team)

    Wednesday, December 19, 2012 4:16 PM