Code:
using System.Data;
using System.Data.SqlClient;
using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using System.Text;
namespace SilverlightWithWCFService.Web
{
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class SampleService
{
[OperationContract]
public string GetName()
{
return "John";
}
}
}
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel;
using SilverlightWithWCFService.CustomerService;
namespace SilverlightWithWCFService
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
SampleServiceClient client = new SampleServiceClient();
client.CustomerListCompleted += new EventHandler<CustomerListCompletedEventArgs>(client_CustomerListCompleted);
client.CustomerListAsync();
client.GetNameCompleted += new EventHandler(client_GetNameCompleted);
client.GetNameAsync();
}
void client_CustomerListCompleted(object sender, CustomerListCompletedEventArgs e)
{
CustomerGrid.ItemsSource = e.Result;
}
void client_GetNameCompleted(object sender, SampleService.GetNameCompletedEventArgs e)
{
textblock1.Text = (string)e.Result;
}
void Func(string s)
{
}
}
}
but it gives error as "Error 1 The type name 'GetNameCompletedEventArgs' does not exist in the type 'SilverlightWithWCFService.CustomerService.SampleService' C:\Users\.................e\MainPage.xaml.cs 38 67 SilverlightWithWCFService
"
Also let me add few more thing
i added this method after customerlist ,also its hsowingh me that method when i click on discover or go button in window,Rebuilt the solution too
any idea