protected void ButtonSubmit_Click(object sender, EventArgs e) { WattsALoanServiceReference.LoanType loanType = new WattsALoanServiceReference.LoanType(); loanType.LoanTypeName = TbxLoanType.Text; WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); bool result = client.InsertLoanType(loanType); client.Close(); string script = @"alert(""Add loan type " + TbxLoanType.Text; if (result) { script += @" success."");"; TbxLoanType.Text = ""; } else { script += @" failed."");"; } ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); }