private void RenderGrid()
        {
            var brandBll = new BrandBll();

            GridBrands.DataSource = brandBll.GetBrands();
            GridBrands.DataBind();
        }
Exemple #2
0
    private void GetBrands()
    {
        GridBrands.DataSource = null;
        GridBrands.DataBind();
        DataSet GetBrands = new DataSet();

        GetBrands             = objHotLeadBL.GetBrandsList();
        GridBrands.DataSource = GetBrands.Tables[0];
        GridBrands.DataBind();
    }
        protected void search_OnClick(object sender, EventArgs e)
        {
            var brandBll = new BrandBll();

            try
            {
                GridBrands.DataSource = brandBll.SearchBrands(searchTerm.Text);
                GridBrands.DataBind();
            }
            catch (Exception exception)
            {
                error.InnerText = exception.Message;
            }
        }
        protected void orderByName_OnClick(object sender, EventArgs e)
        {
            var brandBll = new BrandBll();

            var orderName = (string)Session["orderName"];
            var brands    = brandBll.SearchBrands(searchTerm.Text);

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

            Session["orderName"] = orderName;

            GridBrands.DataSource = brands;
            GridBrands.DataBind();
        }