Exemplo n.º 1
0
    private void PopulateControls()
    {
        string departmentId = Request.QueryString["DepartmentID"];
        string categoryId   = Request.QueryString["CategoryID"];

        if (categoryId != null)
        {
            // Retrieve category and department details and display them
            Category cd = CatalogAccess.GetCategoryDetails(categoryId);
            catalogTitleLabel.Text = HttpUtility.HtmlEncode(cd.Name);
            DepartmentDao dao        = new DepartmentDao();
            Department    department = dao.Find(departmentId);
            catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(cd.Description);

            this.Title = HttpUtility.HtmlEncode(CdShopConfiguration.SiteName + ": " + department.Name + ": " + cd.Name);
        }
        else if (departmentId != null)
        {
            DepartmentDao dao        = new DepartmentDao();
            Department    department = dao.Find(departmentId);
            catalogTitleLabel.Text       = HttpUtility.HtmlEncode(department.Name);
            catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(department.Description);
            // Set the title of the page
            this.Title = HttpUtility.HtmlEncode(CdShopConfiguration.SiteName + ": " + department.Name);
        }
    }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // Load the grid only the first time the page is loaded
     if (!Page.IsPostBack)
     {
         // Load the categories grid
         BindGrid();
         // Get DepartmentID from the query string
         string departmentId = Request.QueryString["DepartmentID"];
         // Obtain the department's name
         DepartmentDao dao            = new DepartmentDao();
         Department    department     = dao.Find(departmentId);
         string        departmentName = department.Name + "</b>";
         // Link to department
         deptLink.Text        = departmentName;
         deptLink.NavigateUrl = "AdminDepartments.aspx";
     }
 }