using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.ServiceModel; using System.Threading; public partial class AsynchronousCall : System.Web.UI.Page { string EmpName = null; protected void Page_Load(object sender, EventArgs e) { } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { int EmpNo = Convert.ToInt32(DropDownList1.SelectedValue); makeAysnCall(EmpNo); } public void makeAysnCall (int EmpNo) { ServiceReference1.EmpNameServiceClient client = new ServiceReference1.EmpNameServiceClient(); EndpointAddress endpointAddress = client.Endpoint.Address; BasicHttpBinding basicHttpBinding = new BasicHttpBinding(); ServiceReference1.IEmpNameService iEmpNameService = new ChannelFactory<servicereference1.iempnameservice>(basicHttpBinding, endpointAddress).CreateChannel(); AsyncCallback asynCallBack = delegate(IAsyncResult result) { EmpName = iEmpNameService.EndgetEmpName(result); txtEmpName.Text = EmpName; }; iEmpNameService.BegingetEmpName(EmpNo, asynCallBack, iEmpNameService); } }</servicereference1.iempnameservice>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)