Problem with binding the data in a Silverlight while the data is getting from the WCF Service without using linq. solve this problem.

Aug 18, 2009 at 12:41 PM

I'm sending a part of the sample code that i've return, The following is the one that wrote in my application. Can any check it once and let me know the best solution for the below problem.

 void OrganizationBaseLine_Loaded(

object sender, RoutedEventArgs e)
//Here Service reference1 is my WCF Service reference So I Created an object of that class as obj
 ServiceReference1.MNetMetricsServiceClient obj = new MNetMetricSystem.ServiceReference1.MNetMetricsServiceClient();
 obj.GetAllDepartmentsCompleted += new EventHandler<MNetMetricSystem.ServiceReference1.GetAllDepartmentsCompletedEventArgs>(obj_GetAllDepartmentsCompleted);


 void obj_GetAllDepartmentsCompleted(object sender, MNetMetricSystem.ServiceReference1.GetAllDepartmentsCompletedEventArgs e)
            cmdDepartMent.ItemsSource = e.Result;// this is a list binding that data to combobox

The interface I'm using is

    public interface IMNetMetricsService
         List<MYList> GetAllDepartments();
The class that's inheriting from the above Interface is
 public class MNetMetricsService : IMNetMetricsService
        DLMetrics objMetrics = new DLMetrics();
         List<MYList> mlist = new List<MYList>();
        List<MYList> IMNetMetricsService.GetAllDepartments()
            DataTable dt = objMetrics.DLGetAllDepartments(); // this is the method returns dept table(FROM Data Access Layer) so i converted it to List to bind to the combobox
                mlist.Add(new MYList() { MyTable=dt});
            return mlist;

The above is the List I'm binding at the front end. i.e., in  page.xaml.cs Page load event. and I'm getting the following error.

Microsoft JScript runtime error: Unhandled Error in Silverlight 2 Application Unrecognized element 'services' in service reference configuration. Note that only a subset of the Windows Communication Foundation configuration functionality is available in Silverlight.   at System.ServiceModel.Configuration.ServiceModelSectionGroup.ReadXml(XmlReader reader)
   at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()
   at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Current()
   at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
   at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
   at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
   at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
   at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)
   at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
   at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
   at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
   at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
   at System.ServiceModel.ClientBase`1..ctor()
   at MNetMetricSystem.ServiceReference1.MNetMetricsServiceClient..ctor()
   at MNetMetricSystem.OrganizationBaseLine..ctor()
   at MNetMetricSystem.Switcher..ctor(IDictionary`2 p)
   at MNetMetricSystem.App.Application_Startup(Object sender, StartupEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Here I didn't use linq. Without LINQ I'm using a WCF Service. 1st of  all is it possible without LINQ to get data from database to silverlight data bindings to controls. If possible can u send me the solution.

If I used LINQ I'm getting the result. Without LINQ is it possible what is the best solution.........................