protected void Page_Load(object sender, EventArgs e) { List <Product> product = ItemAuthHandler.getProducts(); var dataSource = product.Select(x => new { x.productID, x.productName, x.productStock, x.ProductType.productTypeName, x.productPrice }); viewProduct.DataSource = dataSource; viewProduct.DataBind(); if (Session["userrole"].ToString() == "Administrator") { adminPvl.Style.Add("display", "inline"); } else { adminPvl.Style.Add("display", "none"); } }
public static List <Product> getProducts() { return(ItemAuthHandler.getProducts()); }