protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //Obtain product code from query string
                string prodcd = Request.QueryString["prodcd"].ToString();

                //Create a product object
                Product prod = new Product();

                //Get existing product by its code
                prod.GetProductByCode(prodcd);

                //Update all fields
                prod.Modified = DateTime.Now;
                prod.IsActive = false;

                //Update the product
                if (prod.UpdateProduct())
                {
                    //ScriptManager.RegisterStartupScript(this, GetType(), "", "parent.location.reload(true);", true);
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "window.top.window.$.fancybox.close();", true);
                }
                else
                {
                    LabelOutput.ForeColor = System.Drawing.Color.Red;
                    LabelOutput.Text = "Error: Deactivation Failed";
                }
            }
            catch (Exception ex)
            {
                LabelOutput.ForeColor = System.Drawing.Color.Red;
                LabelOutput.Text = "Error: " + ex.Message;
            }
        }
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                try
                {
                    //Get the file extension
                    FileInfo finfo = new FileInfo(FileUpload1.FileName);
                    string fileExtension = finfo.Extension.ToLower();

                    //Save file to server
                    FileUpload1.SaveAs(Server.MapPath("~/Images/Product_Images/") +
                         LabelProductCode.Text + fileExtension);
                }
                catch (Exception ex)
                {
                    LabelOutput.Text = "ERROR: " + ex.Message.ToString();
                    return;
                }
            }

            try
            {
                //Create a product object
                Product prod = new Product();

                //Get existing product by its code
                prod.GetProductByCode(LabelProductCode.Text);

                //Update all fields
                prod.Name = TextBoxName.Text;
                prod.Brand = TextBoxBrand.Text;
                prod.Description = TextBoxDescription.Text;
                prod.CategoryID = Convert.ToInt32(DropDownListCategory.SelectedValue);
                prod.Msrp = Convert.ToDouble(TextBoxMSRP.Text);
                prod.IsFreeShipping = CheckBoxFreeShipping.Checked;
                prod.IsTaxFree = CheckBoxTaxFree.Checked;
                prod.QuantityInStock = Convert.ToInt32(TextBoxQtyInStock.Text);
                prod.IsQuantityUnlimited = CheckBoxQtyUnlimited.Checked;
                prod.Modified = DateTime.Now;

                //Update the product
                if (prod.UpdateProduct())
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "", "window.top.window.$.fancybox.close();", true);
                    //Response.Redirect("~/Admin/Products.aspx");
                }
                else
                {
                    LabelOutput.ForeColor = System.Drawing.Color.Red;
                    LabelOutput.Text = "Error: Update Failed";
                }
            }
            catch (Exception ex)
            {
                LabelOutput.ForeColor = System.Drawing.Color.Red;
                LabelOutput.Text = "Error: " + ex.Message;
            }
        }