Simple DataBind in Silverlight

No.of Views1074
Bookmarked0 times
Downloads 
Votes0
By  usamawahabkhan   On  11 Jun 2010 11:06:52
Tag : Silver Light and XAML , Data Binding
ADO.Net Classes is Absent in Silverlight That why some time Developer get confused How Retrieve Data in Silvrelight Application? Silverlight Provide ServiceModel Class You Thought this Class You can Call Web services
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

ADO.Net Classe is Absent in Silverlight That why some time Developer get confused How Retrieve Data in Silvrelight Application? Silverlight Provide ServiceModel Class You Thought this Class You can Call Web services ,WCF Services , RIA Services, Syndication (Rss,Atom) To Get Data. For Communicate with Data Base Web Prefer to Use Entity Framework Or We Can Use Linq to Sql, ADo.net Also through Services

Image Loading

Steps By Step Implementation

Here i am try to Retrieve Data form Sql in my DataGridControl

1 Create Silverlight Application.

Image Loading

 

Image Loading

 

2 Add DataGrid Control and set its Properties .

 

Image Loading


3 Add Web Service to you Asp.net Application Where u display Silverlight Application (.XAP).

 

Image Loading

 

Image Loading

 

Image Loading

 

Image Loading

4 Add EntityFramework Data Model and Connect it to Database Thought Wizard.

 

Image Loading

 

Image Loading

5 Add any Table to your EntityFramework Data Mode Like (Products).

 

Image Loading

6 Add Function in your webservice (MydataServices.asmx.cs) .

 

Image Loading

7 Set return Type to List tableName type like List.

 

Image Loading

 

8 Add Linq Select Qurey and return toList() .

 

Image Loading

9 Add Service in you Silver light Application in Service References

10 Create load function call Service and Service Completed Event

11 on Completed ( EventArgs e ) Retrieve e.result.tolist() ,

12  assigned to DataGrid Item Source Property

Image Loading

 that's all press F5 and run application.

Sample Project Source

Download source files-1.8MB

 
Sign Up to vote for this article
 
About Author
 
usamawahabkhan
Occupation-Not Provided
Company-Not Provided
Member Type-Senior
Location-Pakistan
Joined date-06 May 2010
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top