Adding a Close Button in LightSwitch 2012

Here we will see how to add a Close Button on an Editable Grid Screen using LightSwitch Visual Studio 2012.

Procedure for how to add a Close Button on a Screen.

Step 1

Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer.

sol exp.jpg

Right-click on the Data Sources and choose "Add Table".

Add table.jpg

The table appears in the table designer window. Insert the records in the following table.

employee.jpg

Step 2

Now once again go to the Solution Explorer, Right-click on Screens and choose "Add Screen".

Add src.jpg

The Add New Screen dialog box appears. Select the "Editable Grid Screen" from the Screen Template, under screen information, choose "Employee" under screen data and provide some name to the Screen and click the OK button.

editable.jpg

The Screen Designer appears as shown below.

src desi.jpg

Step 3

Press F5 to run the application. Add a new item to the list.

output1.jpg

We will notice that we have only two buttons "Save" and "Refresh".

The "Save" button saves all the data in the current screen.

The "Refresh" button refreshes all the data in the current screen.

Step 4

Stop debugging the application.

Once again go to the screen designer, under the Screen Command Bar click on "Add", a drop down list will appear.

add close.jpg

Select the Close button from the drop down list. Note that the Close button will be added under the Screen Command Bar.

src desi1.jpg

Step 5

Once again press F5 to run the application. Now see that the Close button has been added in the footer of the Screen.

close button.jpg

The "Close" button is used to close the current screen.


empty src.jpg