protected void button_OnClick(object sender, EventArgs e) { var brandBll = new BrandBll(); var isInt = int.TryParse(brandId.Text, out int id); if (!isInt) { Response.Redirect("Brands.aspx"); } try { brandBll.EditBrand(id, name.Text); Response.Redirect("Brands.aspx"); } catch (Exception exception) { lblError.Text = exception.Message; } }