protected void btnSaveProduct_Click(object sender, EventArgs e) { InventoryBL bl = new InventoryBL(); tbl_Products product = new tbl_Products() { Product_ID = Convert.ToInt32(hdnProductId.Value), Product_Name = txtProductName.Text, SKU = txtSKU.Text, Supplier_Id = Convert.ToInt32(ddlSupplier.SelectedValue), Category_Id = Convert.ToInt32(ddlCategory.SelectedValue), Brand_Id = Convert.ToInt32(ddlBrand.SelectedValue), Store_Id = Convert.ToInt32(ddlStore.SelectedValue), Product_Description = txtDescription.Text, Product_Quantity = Convert.ToInt32(txtQuantity.Text), Price = Convert.ToInt32(txtPrice.Text), ExpiryDate = !string.IsNullOrEmpty(txtExpiryDate.Text) ? Convert.ToDateTime(txtExpiryDate.Text) : DateTime.MaxValue, Availability = Convert.ToBoolean(ddlActive.SelectedValue) }; //if (!bl.ValidateProduct(product)) //{ bool result = bl.SaveProduct(product); if (result == true) { ScriptManager.RegisterStartupScript(this, GetType(), "product error", "alert('Product Saved successfully!');", true); Response.Redirect("products.aspx"); } // } }