Searching Multiple Parameters in LightSwitch 2012 - Part 1

Here we will see how to create a table, add a relationship and add a screen in a LightSwitch Application (Visual C#) in Visual Studio 2012.

The following is the procedure for adding tables and screens in LightSwitch.

Step 1

Open the Solution Explorer.

Sol exp.jpg

Step 2

In the Solution Explorer, right-click on the Server and choose "Add Table".

Add tab.jpg

Step 3

In this way we will add two tables.

One is the Student Table.

Stu Table.jpg

The other one is the Branch Table.

Branch.jpg

Step 4

Click on the "Add Relationship" button in the menu bar in order to add the relationship between the two tables.

relationship option.jpg

The relationship dialog box appears. From that dialog box select the tables and establish a one-to-many relationship between the Branch and Student table and click the "OK" button.

Add new Relationship.jpg

The relationship will be established between the two tables.

relationship shown.jpg

Step 5

In the Solution Explorer, right-click on the Screens and choose "Add Screen".

Add Src.jpg

Step 6

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

src1.jpg

The screen designer appears for the Editable Branches Grid.

branch src desi.jpg

In the same way we will add another "Editable Grid Screen" for the Student Table.

src2 student.jpg

The screen designer appears for the Editable Students Grid.

studentsrc desi.jpg

Step 7

Press F5 to run the application and provide some data to both the screens (
Editable Branches Grid and Editable Students Grid).

Editable Branches Grid

output branch.jpg

Editable Students Grid

output student.jpg