protected void PopulateControls()
        {
            string prodID = Request.QueryString["ProductID"];

            Product pd = CatalogAccess.GetProductDetails(prodID);

            titleLabel.Text    = pd.Name;
            prodImage.ImageUrl = "Images/" + pd.Image;
            descLabel.Text     = pd.Description;
            priceLabel.Text    = string.Format("{0:c}", pd.Price);
        }
        protected void PopulateControls()
        {
            string deptID = Request.QueryString["DepartmentID"];
            string catID  = Request.QueryString["CategoryID"];

            if (catID != null)
            {
                DataList1.DataSource = CatalogAccess.GetProductsbyCatID(catID);
                DataList1.DataBind();
            }
            else if (deptID != null)
            {
                DataList1.DataSource = CatalogAccess.GetProductsByDeptID(deptID);
                DataList1.DataBind();
            }
            else
            {
                deptID = "1";
                DataList1.DataSource = CatalogAccess.GetProductsByDeptID(deptID);
                DataList1.DataBind();
            }
        }
Ejemplo n.º 3
0
        protected void PopulateControls()
        {
            string deptID = Request.QueryString["DepartmentID"];

            string catID = Request.QueryString["CategoryID"];

            if (catID != null || deptID != null)
            {
                departmentList.DataSource = CatalogAccess.GetAllDepartments();
                departmentList.DataBind();

                categoryList.DataSource = CatalogAccess.GetAllCategoriesByDeptID(deptID);
                categoryList.DataBind();
            }
            else // we do not have any variables in the query string
            {
                departmentList.DataSource = CatalogAccess.GetAllDepartments();
                departmentList.DataBind();

                categoryList.DataSource = CatalogAccess.GetAllCategoriesByDeptID("1");
                categoryList.DataBind();
            }
        }