Exemplo n.º 1
0
        private void SearchGridFill()
        {
            LibrarySettingsClient oClient = new LibrarySettingsClient(ServiceConfig.LibraryDataEndPoint(), ServiceConfig.LibraryDataUri());

            grdSearch.DataSource = oClient.GetLibrarySearch(txtSearch.Text.Trim());
            grdSearch.DataBind();
        }
Exemplo n.º 2
0
        protected void grdSearch_Sorting(object sender, GridViewSortEventArgs e)
        {
            LibrarySettingsClient oClient            = new LibrarySettingsClient(ServiceConfig.LibraryDataEndPoint(), ServiceConfig.LibraryDataUri());
            List <LibrarySettings.LibraryData> oList = new List <LibraryData>();

            oList = oClient.GetLibrarySearch(txtSearch.Text.Trim());
            DataTable dtSortTable = new DataTable();

            dtSortTable = Common.ToDataTable(oList);
            if (dtSortTable != null)
            {
                DataView dvSortedView = new DataView(dtSortTable);
                dvSortedView.Sort    = e.SortExpression + " " + ViewState["SortDirection"].ToString();
                grdSearch.DataSource = dvSortedView;
                grdSearch.DataBind();

                if (ViewState["SortDirection"] != null)
                {
                    if (ViewState["SortDirection"].ToString() == "DESC")
                    {
                        ViewState["SortDirection"] = "ASC";
                    }
                    else
                    {
                        ViewState["SortDirection"] = "DESC";
                    }
                }
            }
        }