protected void btnAdd_Click(object sender, EventArgs e) { lblError.Text = ""; lblSuccess.Text = ""; try { if (txtServer.Text.ToString().Trim() != "") { objclsBALApplication = new clsBALApplication(); string strServerName = txtServer.Text.ToString(); bool flag = CheckIFServerExists(strServerName); if (flag == true) { objclsBALApplication.UpdateServerStatus(strServerName); lblError.Text = "Server saved exists."; } else { bool bln = objclsBALApplication.SaveServer(strServerName); lblSuccess.Text = "Server saved successfully"; txtServer.Text = ""; PopulateGrid(); } PopulateGrid(); } else { lblError.Text = "Please fill server name."; } } catch (NullReferenceException) { Response.Redirect("wfrmErrorPage.aspx", true); } catch (Exception ex) { HttpContext context = HttpContext.Current; LogException objclsLogException = new LogException(); objclsLogException.LogErrorInDataBase(ex, context); Response.Redirect("wfrmErrorPage.aspx", true); } }