Esempio n. 1
0
        private void RenderGrid()
        {
            var categoryBll = new CategoryBll();

            GridCategories.DataSource = categoryBll.GetCategories();
            GridCategories.DataBind();
        }
Esempio n. 2
0
        protected void search_OnClick(object sender, EventArgs e)
        {
            var categoryBll = new CategoryBll();

            try
            {
                GridCategories.DataSource = categoryBll.SearchCategories(searchTerm.Text);
                GridCategories.DataBind();
            }
            catch (Exception exception)
            {
                error.InnerText = exception.Message;
            }
        }
Esempio n. 3
0
        protected void orderByName_OnClick(object sender, EventArgs e)
        {
            var categoryBll = new CategoryBll();

            var orderName  = (string)Session["orderName"];
            var categories = categoryBll.SearchCategories(searchTerm.Text);

            if (orderName == "desc")
            {
                orderName  = "asc";
                categories = categories.OrderBy(p => p.Name).ToList();
            }
            else
            {
                orderName  = "desc";
                categories = categories.OrderByDescending(p => p.Name).ToList();
            }

            Session["orderName"] = orderName;

            GridCategories.DataSource = categories;
            GridCategories.DataBind();
        }