Simple DataBind in Silverlight

Tuesday, January 12, 2010





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 . Here i am try to Retrieve Data form Sql in my DataGridControl
1 Create Silverlight Application.
2 Add DataGrid Control and set its Properties .
3 Add Web Service to you Asp.net Application Where u display Silverlight Application (.XAP).
3 Add EntityFramework Data Model and Connect it to Database Thought Wizard.
4 Add any Table to your EntityFramework Data Mode Like (Products).
5 Add Function in your webservice (MydataServices.asmx.cs) .
6 Set return Type to List tableName type like List.
7 Add Linq Select Qurey and return toList() .
8 Add Service in you Silver light Application in Service References
9 Create load function call Service and Service Completed Event
10 on Completed ( EventArgs e ) Retrieve e.result.tolist() ,
11 assigned to DataGrid Item Source Property
















By Usama Wahab Khan


share this post
Share to Facebook Share to Twitter Share to Google+ Share to Stumble Upon Share to Evernote Share to Blogger Share to Email Share to Yahoo Messenger More...

2 comments:

Zeeshan said...

Salam,

As our telephonic conversation, i have some issues with silverlight DML operation.

Please guide me how i perform simple DML operation using RIA services.

Regards,
Zeeshan Raees
Senior Software Engineer
zeeshan.raees@alfalahghp.com
developerxone@hotmail.com

Rajaram Murali Padgal said...

can we do databinding to gridview without using webservices