Articles → LIGHT SWITCH 2011 → Bind Grid With View In Lightswitch 2011
Bind Grid With View In Lightswitch 2011
Software Requirement
- Visual studio 2010 is installed on your machine.
- Visual Studio 2010 service pack 1 is installed on your machine.
- Microsoft Visual Studio Light switch 2011 is installed on your machine.
Prerequisite Knowledge
- How to create lightswitch project?
- How to create an entity in lightswitch?
- How to create a screen in lightswitch?
- Basics about objects like tables, views etc in SQL server
Steps For Execution
- Create a new lightswitch project
- Create tables
- Adding data in the tables
- Add data source in lightswitch
- Add new screen from table
- Add view in the database.
- Update data source.
- Add new screen from view
Create A New Lightswitch Project
Click to Enlarge
Create Tables
Click to Enlarge
Click to Enlarge
Adding Data In The Tables
Click to Enlarge
Click to Enlarge
Add Data Source In Lightswitch
Click to Enlarge
Click to Enlarge
Click to Enlarge
- Enter server name
- Select authentication type i.e. windows authentication or SQL Server authentication.
- Select database.
- Click on ‘Test Connection’ (this step is optional).
- Once the connection is tested successfully click on Ok.
Click to Enlarge
Click to Enlarge
Add View In The Database
CREATE VIEW vw_GetEmployeeData AS
SELECT
e.EmployeeId,
e.EmployeeName,
d.DepartmentName
FROM
Employee e
INNER JOIN Department d ON e.DepartmentId = d.DepartmentId
Update Data Source
Click to Enlarge
Click to Enlarge
Click to Enlarge
Click to Enlarge
Add New Screens
Click to Enlarge
Click to Enlarge
Output
Click to Enlarge
Click to Enlarge