protected void btnSave_Click(object sender, EventArgs e) { try { prodObj = new ProductClass(); prodObj.description = txtDescription.Text.Trim(); prodObj.unitPrice = txtUnitPrice.Text.Trim(); prodObj.typ = "Manual"; if (string.IsNullOrEmpty(btnSave.CommandArgument)) { if (prodObj.SaveProductMaster()) { ClearControls(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "successfull('Product Added Successfully.','')", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "failed('Failed to Product to add Customer.','')", true); } } else { prodObj.prodId = btnSave.CommandArgument; if (prodObj.UpdateProductMaster()) { ClearControls(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "successfull('Product Updated Successfully.','')", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "failed('Failed to Product to Update Customer.','')", true); } } } catch (Exception ex) { ex.Message.ToString(); } }