This is the sixth part of the 11 series LightSwitch tutorial. In this part we will learn about how to work with the Details screen for viewing the Master-Child records
Table of Content
- Aim of the article
- Functionalities of the Details Screen
- Create a Master Child Relationship
- Steps to create Details Screen
Rapid business application development is a need of today’s business and keeping that in focus software stewards wants to build the 3 tire applications at a lightning speed where there will be less code, less time will be spent on designing the UI screens , the BAL layer and DAL layer. By keeping all these into focus, on 26th July, 2011, Microsoft has released their new product – LightSwitch.
It is the simplest way for developers of all skill levels to develop business applications for the desktop as well as for cloud. This is the sixth part of the series of 12 LightSwitch tutorials. In this part we will look into how to work with Details screen.
You can read the other parts of the LightSwitch tutorial as under
- Part 1: Introduction to Light Switch
- Part 2: Rapport with New Data Screen
- Part 3: Rapport with Search Data Screen
- Part 4: Rapport with Editable Grid Screen
- Part 5: Rapport with List and Details Screen
- Part 6: Rapport with Details Screen
- Part 7: Rapport with External Data Source – Database
- Part 8: Rapport with External Data Source – WCF RIA Service
- Part 9:Using a custom control in LightSwitch
- Part 10: Publish LightSwitch Application as Desktop application and host in local system
- Part 11: Publish LightSwitch Application as Web application
The article assumes that, we have LightSwitch 2011 installed in our system
This screen provides a lot of functionalities which are listed as under
- View Master/Child Records
- Search the child record
- Sorting the child records for a particular field in the grid
- Navigating among the child records using the inbuilt pagination
- Export the child records to Excel
Out of these various functionalities, we have covered #2 to #5 in the Search Data Screen illustration and henceforth will not be repeated here
As said earlier, Details screen is use when we have a Master/Child records to display.We will create such a requirement first.Let us create another table say tblProject with two fields ID and ProjectName
Now we have to make a relationship between the Employee and the Project table. The intension is to establish a relation as which employees are working in which project. So let us click on the "Relationship" button or Press CTRL + SHIFT + R.
The "Add New Relationship" will appear where we have to map the relationship between those two tables. Set the Multiplicity as "Many to One" indicating that many employee can work in one project.
And the Entity Relationship will appear as under
Now open the Employee table and it will give the below appearence
We can make out that a new datatype by the name "ProjectItemCollection" has appeared.
So our Master/Child realtionship has been created between the Employee and the Project table
Now add a New Data Entry screen for project where the Screen Data should be "ProjectItem"
Hit F5 and add some records to the Project Data entry screen
From the Screen Template, choose the "Details screen". Enter a proper Screen Name and choose tblEmployee from the Screen Data.Also include the "tblEmployee tblProject". And make teh Employee screen as the default screen.
Run the application.Initially it will appear as under
Hit the search screen and click the "Deepak" record.The result is as under
We can make out that Employee "Deepak" has worked for 3 project
So in this part we have seen how to work with the Details screen for viewing the Master-Child records.We have also seen how to create a Master/Child relationship and as well as figure out the other functionalities that this screen is providing us.In the next article we will look into how to interact with external database.
Thanks for reading the article.Happy lightning with LightSwitch.