protected void Page_Load(object sender, System.EventArgs e) { // Get the Category ID CategoryInfo category = new CategoryInfo(); _categoryID = (int)dataSource; if (!Page.IsPostBack) { cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); if (!Null.IsNull(_categoryID)) { CategoryController controller = new CategoryController(); //Bind parent category list... ddlParentCategory.DataSource = controller.GetCategoriesPath(PortalId, true, -1); ddlParentCategory.DataTextField = "CategoryPathName"; ddlParentCategory.DataValueField = "CategoryID"; ddlParentCategory.DataBind(); ddlParentCategory.Items.Insert(0, new ListItem(Localization.GetString("None", this.LocalResourceFile), "-1")); category = controller.GetCategory(_categoryID); if (category != null) { cmdDelete.Visible = true; txtCategoryName.Text = category.CategoryName; //txtDescription.Text = category.CategoryDescription; //chkArchived.Checked = category.Archived; //txtMessage.Text = category.Message; //txtOrder.Text = category.OrderID.ToString(); if (category.ParentCategoryID != Null.NullInteger && category.ParentCategoryID > 0) { if (ddlParentCategory.Items.FindByValue(category.ParentCategoryID.ToString()) != null) { ddlParentCategory.ClearSelection(); ddlParentCategory.Items.FindByValue(category.ParentCategoryID.ToString()).Selected = true; } } } } } }
protected void Page_Load(object sender, System.EventArgs e) { _nav = new AdminNavigation(Request.QueryString); if (_nav.CategoryID != Null.NullInteger) { plhGrid.Visible = false; plhForm.Visible = true; if (_nav.CategoryID == 0) { lblEditTitle.Text = Localization.GetString("AddCategory", this.LocalResourceFile); loadEditControl("CategoryEdit.ascx", _nav.CategoryID); } else { lblEditTitle.Text = Localization.GetString("EditCategory", this.LocalResourceFile); loadEditControl("CategoryEdit.ascx", _nav.CategoryID); } } else { plhGrid.Visible = true; plhForm.Visible = false; CategoryController categoryController = new CategoryController(); ArrayList categoryList = categoryController.GetCategoriesPath(PortalId, false, -1); if (categoryList.Count > 0) { // Has page index been initialized? if (_nav.PageIndex == Null.NullInteger) { _nav.PageIndex = 0; } // Update the grid grdCategories.PageSize = 20; grdCategories.AllowPaging = true; grdCategories.DataSource = categoryList; grdCategories.CurrentPageIndex = _nav.PageIndex; grdCategories.DataBind(); } } }
protected void Page_Load(object sender, System.EventArgs e) { try { // Get the navigation settings _nav = new CatalogNavigation(Request.QueryString); _nav.ProductID = (int)dataSource; // Handle ProductID=0 as Null.NullInteger if (_nav.ProductID == 0) { _nav.ProductID = Null.NullInteger; } if (!Page.IsPostBack) { // Load category list CategoryController categoryController = new CategoryController(); cmbCategory1.DataSource = categoryController.GetCategoriesPath(this.PortalId, true, 4); cmbCategory1.DataBind(); cmbCategory2.DataSource = categoryController.GetCategoriesPath(this.PortalId, true, 10); cmbCategory2.DataBind(); cmbCategory3.DataSource = categoryController.GetCategoriesPath(this.PortalId, true, 18); cmbCategory3.DataBind(); // Set delete confirmation cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); // Are we editing or creating new item? if (_nav.ProductID != Null.NullInteger) { ProductController controller = new ProductController(); ProductInfo product = controller.GetProduct(_nav.ProductID); if (product != null) { cmdDelete.Visible = true; //txtManufacturer.Text = product.Manufacturer; txtModelName.Text = product.ModelName; txtModelNumber.Text = product.ModelNumber; txtSummary.Text = product.Summary; //txtSummary2.Text = product.Summary; txtUnitPrice.Text = product.UnitCost.ToString("0.00"); tbPriceStr.Text = product.PriceStr; /* image1.FileFilter = "bmp,png,jpg,jpeg,gif"; image1.ShowDatabase = true; image1.ShowFiles = true; image1.ShowLog = false; image1.ShowNewWindow = false; image1.ShowNone = true; image1.ShowSecure = true; image1.ShowTabs = false; image1.ShowTrack = false; image1.ShowUpLoad = true; image1.ShowUrls = true; image1.ShowUsers = false; */ /*PrepareImage(image1); if (product.ProductImage.StartsWith("http://")) { image1.UrlType = "U"; } else { image1.UrlType = "F"; } image1.Url = product.ProductImage; */ //cmbCategory.SelectedValue = product.CategoryID.ToString(); cmbCategory1.SelectedValue = product.CategoryID1.ToString(); cmbCategory2.SelectedValue = product.CategoryID2.ToString(); cmbCategory3.SelectedValue = product.CategoryID3.ToString(); txtNumPages.Text = product.NumPages.ToString(); //System.Web.UI.WebControls.Calendar calPublishDate; //calPublishDate.SelectedDate = product.PublishDate == Null.NullDate ? Null.NullDate : product.PublishDate; ///calPublishDate.SelectedDate = product.PublishDate; ///calPublishDate.VisibleDate = product.PublishDate; tbPublishDate.Text = product.PublishDate.ToString("dd/MM/yyyy"); //Response.Write(product.PublishDate.ToString()); chkArchived.Checked = product.Archived; //chkFeatured.Checked = product.Featured; txtDescription.Text = product.Description; txtDescriptionTwo.Text = product.DescriptionTwo; txtDescriptionThree.Text = product.DescriptionThree; tbDescriptionTag.Text = product.DescriptionTag; txtTOC_Html.Text = product.TOC_Html; //txtTOC_Html.Text = RemoveHTML( product.Description ); //Response.Write("<br>before {" + product.ProductFile + "}{" + file1.Url + "}"); file1 = PrepareFile(file1); if (product.ProductFile == Null.NullString) product.ProductFile = "_no_report_file_available.pdf"; SetFileUrl(file1, "products654654/", product.ProductFile); //Response.Write("<br>after {" + product.ProductFile + "}{" + file1.Url + "}"); //Response.Write("<br>preview before {" + product.ProductPreview + "}{" + preview1.Url + "}"); preview1 = PrepareFile(preview1); if (product.ProductPreview == Null.NullString) product.ProductPreview = "_no_report_file_available.pdf"; SetFileUrl(preview1, "documents/", product.ProductPreview); //Response.Write("<br>preview after {" + product.ProductPreview + "}{" + preview1.Url + "}"); tbFile1.Text = product.ProductFile; tbPreview1.Text = product.ProductPreview; //txtDescription2.Text = product.Description; //txtUnitWeight.Text = product.ProductWeight == Null.NullDecimal ? string.Empty : product.ProductWeight.ToString("0.00"); //txtUnitHeight.Text = product.ProductHeight == Null.NullDecimal ? string.Empty : product.ProductHeight.ToString("0.00"); //txtUnitLength.Text = product.ProductLength == Null.NullDecimal ? string.Empty : product.ProductLength.ToString("0.00"); //txtUnitWidth.Text = product.ProductWidth == Null.NullDecimal ? string.Empty : product.ProductWidth.ToString("0.00"); calSaleStartDate.SelectedDate = product.SaleStartDate == Null.NullDate ? Null.NullDate : product.SaleStartDate; calSaleEndDate.SelectedDate = product.SaleEndDate == Null.NullDate ? Null.NullDate : product.SaleEndDate; txtSalePrice.Text = product.SalePrice == Null.NullDecimal ? string.Empty : product.SalePrice.ToString("0.00"); //Response.Write("AvailableONlie: " + product.AvailableOnline); chkAvailableOnline.Checked = product.AvailableOnline; if (calSaleStartDate.SelectedDate != Null.NullDate) { calSaleStartDate.VisibleDate = calSaleStartDate.SelectedDate; } if (calSaleEndDate.SelectedDate != Null.NullDate) { calSaleEndDate.VisibleDate = calSaleEndDate.SelectedDate; } Session["ok"] = true; } else { // Handle as new item PrepareNew(); } } else { // Handle as new item PrepareNew(); } } } catch(Exception ex) { Response.Write(ex.Message); Response.Write(ex.StackTrace); Response.Write(ex.InnerException); Response.Write(ex.GetBaseException().Message); // Exceptions.ProcessModuleLoadException(this, ex); } }