Filter Records in LightSwitch 2012

Here we will see how to filter data in a LightSwitch Application (Visual C#) in Visual Studio 2012.

The following is the procedure for filtering data in LightSwitch.

Step 1

Open the Solution Explorer.

sol ex.jpg

Step 2

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

add tab.jpg

Step 3

The table appears.

Emp table.jpg

Step 4

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

Add Src.jpg

Step 5

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

Add New Src.jpg

Step 6

The Screen Designer appears.

app designer.jpg

We will first add some data by pressing F5.

out1.jpg

Step 7

In the screen designer, click on the "Edit Query" link as in the following.

Edit link.jpg

Step 8

The Screen will appear. Then in the "Filter" row:

add new filter.jpg

Click on "Add Filter" and add the filter on the following field:

where.jpg


Step 9

There is a red color cross button in the beginning of each row. By clicking on that button you can delete that particular row and remove the filter.

Delete.jpg

Step 12

Again press F5 to run the application.

out2.jpg

Click on the "Add Filter" button to add more rows.

fillter.jpg

The row contains a drop down list with the set of the following fields.

dropdown.jpg

From the following list you can select any field on which you want to apply a filter. 

Step 14


Press F5 once again in order to run the application.

new out1.jpg


Similar Articles