This article describes how to bind a grid with a query in LightSwitch 2012.
In my previous article I described how to add a query on the table in LightSwitch using Visual Studio 2012. (http://www.c-sharpcorner.com/UploadFile/18ddf7/binding-grid-from-query-in-lightswitch-2012-part-1/)This article describes how to bind a grid with a query in LightSwitch 2012.The following is the procedure of binding a grid with a query.Step 1Now first of all we are going to add another Editable Grid Screen. Select Query under Screen Data in the Add New Screen dialog box then click the OK button.Step 2The Screen Designer appears and we will see that the optional parameter will be present at the top in the Screen Designer.Step 3Press F5 to run the application. We will notice that all the data is available if the optional parameter is empty.Once we provide the value in the optional parameter, all the data related to that parameter will be populated.Step 4Now stop debugging and to bind a drop down with a query go to the menu bar and click on Add Data Item.The Add Data Item dialog box appears on the screen. From that choose Local Property and provide some name to the data item and click the OK button.After the data item is added, drag it onto the screen.Step 5The next step is to add a query. Once again click on Add Data Item. The Add Data Item dialog box will appear. Choose Query and click the OK button. The query will be added as in the followingOnce the query has been added click on Add Data Item (Emp). Then press F4. The property window appears. Select the "New Query1" from the Choices option in the property window.Step 6Press F5 to run the application. We will see a drop down list in the output.
Printing in C# Made Easy