How do I create a button on a "Create New Screen" that will Save, Close and Start a new "Create New Screen" in Lightswitch?
Asked Answered
P

1

7

I have a VS 2015 LightSwitch Desktop project in which users will need to enter a large number of records and I would like to streamline the process a bit. I would like to add one button that will Save the current record, close the current "Create New Data" screen, and launch or start a new instance of the same "Create New Data" data screen.

Parquet answered 18/2, 2017 at 17:10 Comment(5)
are there any foreign key relationships on this? The reason I ask is that on the HTML Client, you can open up a popup, and then certain parts of data can be added through custom data items, and then inserted in the database, this would certainly help to speed up the process... on the desktop client do you have the popup option also? and one more question, could you add the table entities so I can see what you are trying to add, I have an idea on a solution but want to try and apply it to your scenarioViperish
Crezzer, sorry about the slow response. To answer your questions. Yes there are relationships. I assume they are foreign key relationships. The relationships are all "one-to-many" or "1 or 0 to many". Right now I am only working on a Silverlight/Desktop application but an HTML.Parquet
Crezzer, sorry about the slow response. To answer your questions. Yes there are relationships. I assume they are foreign key relationships. The relationships are all "one-to-many" or "1 or 0 to many". Right now I am only working on a Silverlight/Desktop application but an HTM solution is forthcoming. There is a popup option but I have not employed it (I don't think) I will try to figure out the best way to convey the table/entities information you request over Stackoverfloor . Any suggestions in that regard?.Parquet
I will have a go at this on Monday on the HTML which I am sure will be possible, and will respond then, I could do with a little more information, what are the table names called, or what are they doing (example headers would be useful)Viperish
Crezzer7, Thank you but unless you can come up with a Desktop/Silverlight solution I will have you stand down. I might pick it up again when I start the HTML project. Thank you again, MarkParquet
H
2

Go to your design screen. select Add Data Item... and create a new method with your favorite name (Default name is Method). drag and drop the created method from left panel at end of your screen and double click on your created method. add the following code{

save();
Application.ShowYourNewScreenName();

enter image description here

Henriettehenriha answered 5/9, 2017 at 8:0 Comment(4)
This solution is great. It also opens a detail screen of the record just saved at the same time it opens the new create screen. Is there an easy way to exclude the detail screen?Parquet
comment or delete this line of code your screen code file. Application.Current.ShowDefaultScreen(this.YourProperty);Henriettehenriha
Is there a way to change the screen or make a different detail screen the Application.Current.ShowDefaultScreen be the default screen to display?Parquet
What I meant is there a way to add and delete fields in the default screen that is displayed? Or can I make a new detail screen and make it the default screen that is called when using the new button?Parquet

© 2022 - 2024 — McMap. All rights reserved.