Custom Search in LightSwitch 2012

In this article you will learn how to make a custom search in LightSwitch 2012.

Getting Started

  1. Open Visual Studio 2012.
  2. Go to "File" => "New" => "Project..."
  3. Select "LightSwitch" in installed templates.
  4. Select "LightSwitch Application (Visual C#)".
  5. Enter the Name and choose the location.
  6. Click "OK".

The next step is to add data sources or add tables. After that add a new query after right-clicking on the data source.

img1.jpg

Image 1.

Now add a filter condition and add a select columns name and add new parameters.

img2.jpg

Image 2.

As you can see, a query has been added to the selected data source.

img3.jpg

Image 3.

Now add a new screen and select screen data and select that query name.

img4.jpg

Image 4.

As you can see, a filter parameter has been added, you can also edit the query.

img5.jpg

Image 5.

Hit F5 to see the result.

img6.jpg

Image 6.

As you can see, the search text box is empty and it's mandatory, if you enter a contact name then that will show the result, let's do a little more exited.

Go to the properties of the screen designer and click on the search column and go to "Properties".

img7.jpg

Image 7.

Click on the "Choice List" link button.

img8.jpg

Image 8.

Add a few values and display name and click "OK".

Now run the project.

img9.jpg

Image 9.

As you can see all choices are loading a search text box, now choose one contact name to see the result.

img10.jpg

Image 10.


Similar Articles