// Product/List/:id public IActionResult ListByCategory(Guid id) { ProductListVM vm = new ProductListVM(); vm.categories = _categoryBLL.GetAllCategories(); vm.products = _productBLL.GetProductsByCategoryID(id); return(View("List", vm)); }
protected void CategoryDisplayGrid_Sorting(object sender, GridViewSortEventArgs e) { DataView sortedView; string sortingDirection = string.Empty; if (direction == SortDirection.Ascending) { direction = SortDirection.Descending; sortingDirection = "Desc"; } else { direction = SortDirection.Ascending; sortingDirection = "Asc"; } ds = CategoryBLL.GetAllCategories(); CategoryDisplayGrid.DataSource = ds; sortedView = new DataView(ds.Tables[0]); sortedView.Sort = e.SortExpression + " " + sortingDirection; Session["SortedView"] = sortedView; CategoryDisplayGrid.DataSource = sortedView; CategoryDisplayGrid.DataBind(); }
private void BindDropSearch() { ddlCatName.DataSource = CategoryBLL.GetAllCategories(); ddlCatName.Items.Insert(0, new ListItem("Select Category", "")); ddlCatName.DataTextField = "categoryName"; ddlCatName.DataValueField = "categoryId"; ddlCatName.DataBind(); }
private void BindGrid(bool isSearch) { if (ddlCatName.SelectedIndex != -1 && isSearch) { Category obj = new Category(); obj.CategoryID = int.Parse(ddlCatName.SelectedValue); CategoryBLL ins = new CategoryBLL(); ds = ins.GetById(obj); } else { ds = CategoryBLL.GetAllCategories(); } CategoryDisplayGrid.DataSource = ds; CategoryDisplayGrid.DataBind(); DropDownList depList = (DropDownList)CategoryDisplayGrid.FooterRow.FindControl("ddlAddDepName"); depList.DataSource = DepartmentBLL.GetAllDepartment(); depList.DataBind(); depList.DataTextField = "Name"; depList.DataValueField = "DepId"; depList.DataBind(); }