protected void textBoxProductID_TextChanged(object sender, EventArgs e) { string ProductID = textBoxProductID.Text; string Name = ""; string Description = ""; decimal Price; decimal SalePrice; int InSale; int Quantity; string CategoryName = ""; string SubCategoryName = ""; string Color = ""; string Weight = ""; //int ProductStatus; Products prodObj = new Products(); prodObj.fnGetProductDetails(ProductID, out Name, out Description, out Price, out SalePrice, out InSale, out Quantity, out CategoryName, out SubCategoryName, out Color, out Weight); //out ProductStatus); textBoxAddProductName.Text = Name; textBoxAddProductDescription.Text = Description; textBoxAddProductPrice.Text = Price.ToString(); textBoxAddProductSalePrice.Text = SalePrice.ToString(); textBoxProductQuantity.Text = Quantity.ToString(); textBoxAddProductColor.Text = Color; dropDownAddCategory.Text = CategoryName; textBoxAddProductWeight.Text = Weight; Session["ProductID"] = textBoxProductID.Text; Session["ProductName"] = textBoxAddProductName.Text; Session["ProductDescription"] = textBoxAddProductDescription.Text; Session["ProductCategory"] = dropDownAddCategory.SelectedItem; Session["ProductSubCategory"] = SubCategoryName; Session["ProductPrice"] = Convert.ToDouble(textBoxAddProductPrice.Text); Session["ProductSalePrice"] = Convert.ToDouble(textBoxAddProductSalePrice.Text); Session["ProductQuantity"] = Convert.ToInt32(textBoxProductQuantity.Text); Session["ProductColor"] = textBoxAddProductColor.Text; Session["ProductWeight"] = textBoxAddProductWeight.Text; if (InSale == 1) { checkBoxInSale.Checked = true; } else { checkBoxInSale.Checked = false; } dropDownAddCategory.SelectedValue = Session["ProductCategory"].ToString(); dropDownAddCategory_SelectedIndexChanged(this.dropDownAddCategory, EventArgs.Empty); }
protected void textBoxProductID_TextChanged(object sender, EventArgs e) { string ProductID = textBoxProductID.Text; string Name = ""; string Description = ""; decimal Price; decimal SalePrice; int InSale; int Quantity; string CategoryName = ""; string SubCategoryName = ""; string Color = ""; string Weight = ""; //int ProductStatus; try { Products prodObj = new Products(); prodObj.fnGetProductDetails(ProductID, out Name, out Description, out Price, out SalePrice, out InSale, out Quantity, out CategoryName, out SubCategoryName, out Color, out Weight); //out ProductStatus); Session["ProductCategory"] = CategoryName; if (Name != null) { textBoxAddProductName.Text = Name; } if (Description != null) { textBoxAddProductDescription.Text = Description; } textBoxAddProductPrice.Text = Price.ToString(); textBoxAddProductSalePrice.Text = SalePrice.ToString(); textBoxProductQuantity.Text = Quantity.ToString(); if (Color != null) { textBoxAddProductColor.Text = Color; } if (CategoryName != null) { dropDownAddCategory.Text = CategoryName; } if (Weight != null) { textBoxAddProductWeight.Text = Weight; } Session["ProductID"] = textBoxProductID.Text; Session["ProductName"] = textBoxAddProductName.Text; Session["ProductDescription"] = textBoxAddProductDescription.Text; Session["ProductCategory"] = dropDownAddCategory.SelectedItem; Session["ProductSubCategory"] = SubCategoryName.ToString(); Session["ProductPrice"] = Convert.ToDouble(textBoxAddProductPrice.Text); Session["ProductSalePrice"] = Convert.ToDouble(textBoxAddProductSalePrice.Text); Session["ProductQuantity"] = Convert.ToInt32(textBoxProductQuantity.Text); Session["ProductColor"] = textBoxAddProductColor.Text; Session["ProductWeight"] = textBoxAddProductWeight.Text; if (InSale == 1) { checkBoxInSale.Checked = true; } else { checkBoxInSale.Checked = false; textBoxAddProductSalePrice.Enabled = false; } dropDownAddCategory.Text = Session["ProductCategory"].ToString(); dropDownAddCategory_SelectedIndexChanged(this.dropDownAddCategory, EventArgs.Empty); } catch (Exception ex) { Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('" + ex.Message + "')</SCRIPT>"); Response.Redirect("Error.aspx"); } }