BrainDump
  Home arrow BrainDump arrow Page 2 - Introduction to Binding ComboBox and DataG...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

Introduction to Binding ComboBox and DataGrid Controls in Silverlight 2.0
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-02-04

    Table of Contents:
  • Introduction to Binding ComboBox and DataGrid Controls in Silverlight 2.0
  • Developing WCF Service to serve Business (Entity) Objects collection using LINQ to SQL
  • Binding Object Collections Silverlight 2.0 ComboBox control dynamically
  • Binding Object Collections to cascading Silverlight 2.0 ComboBoxes
  • Binding Object Collections to Silverlight 2.0 ComboBox cascading with DataGrid
  • Detailed Explanation

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introduction to Binding ComboBox and DataGrid Controls in Silverlight 2.0 - Developing WCF Service to serve Business (Entity) Objects collection using LINQ to SQL


    (Page 2 of 6 )

    Let us start with a new solution:

    • Create a new Visual Studio 2008 solution.

    • Add a new WCF Service project named “DemoEmpService.”

    • Change “Service1” to “EmpService” throughout the project (steps are shown in my previous articles).

    • Add a “LINQ to SQL Classes” item to the project (“DemoEmp.dbml”).

    • Using “Server Explorer,” drag and drop “Emp” and “Dept” tables as shown in the following image.

    • Modify “IEmpService.vb” as shown below:


    <ServiceContract()> _

    Public Interface IEmpService


    <OperationContract()> _

    Function GetEmployee(ByVal empno As Integer) As Emp


    <OperationContract()> _

    Function GetEmployeeList() As List(Of Emp)


    <OperationContract()> _

    Function GetDepartmentList() As List(Of Dept)


    <OperationContract()> _

    Function GetEmployeeListByDept(ByVal deptno As Integer) As List(Of Emp)


    End Interface



    • Implement the same in the “EmpService” (service) class as follows:


    Imports System.Data.Linq


    ' NOTE: If you change the class name "Service1" here, you must also update the reference to "Service1" in Web.config and in the associated .svc file.

    Public Class EmpService

    Implements IEmpService


    Public Sub New()

    End Sub


    Public Function GetEmployeeList() As System.Collections.Generic.List(Of Emp) Implements IEmpService.GetEmployeeList

    Using ctxt As New DemoEmpDataContext

    ctxt.ObjectTrackingEnabled = False

    Return ctxt.Emps.ToList

    End Using

    End Function


    Public Function GetEmployee(ByVal empno As Integer) As Emp Implements IEmpService.GetEmployee

    Dim objEmp As Emp = Nothing


    Using ctxt As New DemoEmpDataContext

    'retrieve emp row

    objEmp = ctxt.GetTable(Of Emp).SingleOrDefault(Function(p) p.Empno = empno)

    End Using


    Return objEmp

    End Function


    Public Function GetDepartmentList() As System.Collections.Generic.List(Of Dept) Implements IEmpService.GetDepartmentList

    Using ctxt As New DemoEmpDataContext

    ctxt.ObjectTrackingEnabled = False

    Return ctxt.Depts.ToList

    End Using

    End Function


    Public Function GetEmployeeListByDept(ByVal deptno As Integer) As System.Collections.Generic.List(Of Emp) Implements IEmpService.GetEmployeeListByDept

    Using ctxt As New DemoEmpDataContext

    Dim opt As New DataLoadOptions

    opt.LoadWith(Of Dept)(Function(d) d.Emps)

    ctxt.LoadOptions = opt

    ctxt.ObjectTrackingEnabled = False

     

    Dim oDept As Dept = ctxt.Depts.Where(Function(d) d.Deptno = deptno).FirstOrDefault

    Return If(oDept Is Nothing, Nothing, oDept.Emps.ToList)

    End Using

    End Function


    End Class



    More BrainDump Articles
    More By Jagadish Chaterjee


       · Hai,This is my next article in the series focusing on Siverlight 2.0 tutorials. ...
     

    BRAINDUMP ARTICLES

    - Introduction to Office Live Workspace
    - Using MS Excel for One-way Analysis of Varia...
    - Comparing Data Sets Using Statistical Analys...
    - Import Blogger Posts into WordPress Using Wi...
    - Download WordPress from an FTP Server and Ru...
    - Install and Run WordPress in XAMPP Local Host
    - What Windows 7 Brings to the Table
    - Virtualization and Sandbox Detection
    - Advanced Firebug Techniques in Windows XP Ho...
    - Editing CSS with Firebug in Windows XP Home
    - Using Firebug in Windows XP Home
    - Migrating to Exchange Server 2007
    - Using System Restore on a Non-Bootable PC
    - Finding Logged on Users and More Scripting S...
    - Developing Macro Commands in MS Excel





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek