Sorting in the Search Data Screen Using LightSwitch 2011

Introduction

This article describes how to sort data in a Search Data Screen using LightSwitch 2011.

Step 1

 Open Microsoft Visual Studio LightSwitch 2011 and click the "Ok" button.

download (1).jpg

Step 2

 As you can see, there are two links, one to create a new database table and the second to attach to an external data source. Let's click on "Attach to external Data Source".

Clipboard02.jpg

Step 3

 Now click on "Database" and click "Next >".

Clipboard03.jpg

Step 4

 Select the server name and select the database, I am using the Rahul database in this article. Click OK.

Clipboard04.jpg

Step 5

 Select tables and click the "Finish" button.

Clipboard5.jpg

Step 6

 The table look like this.

Clipboard61.jpg

Step 7

Add a new screen now. Right-click on "Screens" and click "Add Screen".

Clipboard7.jpg

Step 8

Here you can select a search data screen template and click "Ok".

Clipboard08.jpg

Step 9

 Now let's run the application to see the output.

Clipboard09.jpg

Step 10

 The output of the appllication.

Clipboard10.jpg

Step 11

We can perform the sorting operation in the Data screen. It is automatic. We only must click on the particular column for performing the sort. In the figure below, we are sorting based on the Salary field.

Clipboard11.jpg