This post discusses how to displays data from the AdventureWorks Database on to Silverlight pages. In this walkthrough you will find the page that displays the data from customer table in adventure database and allows the user to traverse the records. You need to have Visual Studio 2010 SP1 installed on your machine.Silverlight business application contains two projects a Silverlight application and an ASP.NET Web application which hosts the Silverlight application. To change the application string value that displaying in the page1. Expand the assets folder and expand the resources 2. Change the application name as shown below and run the application3. Creating a data model for the application, right click the Silverlight web application click add new item and select the ADO.NET Entity Data model as shown belowIn choose model content page, click generate content from database option as shown in the below dialogue Select the database object that you want to display the data in Silverlight pagesCustomer table appear in the entity designer as shown belowBuild the solution.Adding a domain serviceA domain service exposes the data model to client. You can add the domain service to the server project as shown belowRight click the ASP.NET web application and add new item, select the domain service class from project dialogue boxSelect the Customers table and Enable Editing checking boxes, and then click okBuild the solutionCreating a Silverlight page to display data1. In solution explorer right click the Views folder Silverlight client application, Add New Item dialogue box , select the Silverlight Category and then click the Silverlight Page template.2. To display the data in data grid, click the datasources and then click the Show Data SourcesThe data source window displays the customer entity, drag the customer node to the designer3. Add a navigation button to the page that we created above in Homepage as shown below 1: <Rectangle x:Name="Divider3" Style="{StaticResource DividerStyle}"/> 2: <HyperlinkButton x:Name="Link3" Content="Customer List" Style="{StaticResource LinkStyle}" 3: NavigateUri="/Customers" TargetName="ContentFrame"/>4. Run the application. You will notice Customer List button in navigation bar as shown below
Related posts
HostForLIFE is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.
We have offered the latest Windows 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.
Sign in