protected void UpdateButton_Click(object sender, EventArgs e)
        {
            try
            {
                int EmpId = 0;
                if (txtEmpId.Text != null && txtEmpId.Text != string.Empty)
                {
                    EmpId = Convert.ToInt32(txtEmpId.Text);
                }
                string Name     = txtName.Text.Trim();
                string Salary   = txtSalary.Text.Trim();
                string DeptId   = txtDeptId.Text.Trim();
                string DeptName = txtDeptName.Text.Trim();

                proxy = new ServiceReference1.EmployeeServiceClient();
                ServiceReference1.Employees newStudent =
                    new ServiceReference1.Employees()
                {
                    EmpId    = EmpId,
                    Name     = Name,
                    Salary   = Salary,
                    DeptId   = DeptId,
                    DeptName = DeptName
                };

                proxy.UpdateEmpDetails(newStudent);

                GridViewStudentDetails.DataSource = proxy.GetEmployees();
                GridViewStudentDetails.DataBind();
                lblMsg.Text = "Record Saved Successfully";
            }
            catch (FaultException <ExceptionMessage> exceptionFromService)
            {
                if (ButtonInsert.Visible == true)
                {
                    lblMsg.Text = "Error while adding new customer details :" + exceptionFromService.Detail.errorMessageOfAction;
                }
                else
                {
                    lblMsg.Text = "Error while updating customer details :" + exceptionFromService.Detail.errorMessageOfAction;
                }
            }
            catch (Exception exception)
            {
                if (ButtonInsert.Visible == true)
                {
                    lblMsg.Text = "Error while adding new customer details :" + exception.Message;
                }
                else
                {
                    lblMsg.Text = "Error while updating customer details :" + exception.Message;
                }
            }

            ResetAll();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             proxy = new ServiceReference1.EmployeeServiceClient();
             GridViewStudentDetails.DataSource = proxy.GetEmployees();
             GridViewStudentDetails.DataBind();
         }
         catch (FaultException <ExceptionMessage> exceptionFromService)
         {
             lblMsg.Text = "Error while loading Employee details :" + exceptionFromService.Detail.errorMessageOfAction;
         }
         catch (Exception exception)
         {
             lblMsg.Text = "Error while loading Employee details :" + exception.Message;
         }
     }
 }