void ResourceManagement_BasicSearch_LoadComplete(object sender, EventArgs e) { if (!string.IsNullOrEmpty(SearchText.Text) && !this.ContentSearchCheckBox.Checked) { SearchResourceListView.EnableFeed(SearchText.Text); } }
private void RefreshDataSource(int pageIndex) { int totalPages = 0; string searchText = SearchText.Text; if (!string.IsNullOrEmpty(searchText)) { LabelErrorMessage.Text = string.Empty; try { searchText = SearchText.Text.Trim(); SearchText.Text = searchText; int totalRecords = 0; int pageSize = SearchResourceListView.PageSize; int totalParsedRecords = totalParsedRecords = pageSize * pageIndex; List <Resource> foundRestResource = null; Dictionary <Guid, IEnumerable <string> > userPermissions = null; SortProperty sortProp = null; if (SearchResourceListView.SortDirection == System.Web.UI.WebControls.SortDirection.Ascending) { sortProp = new SortProperty(SearchResourceListView.SortExpression, Zentity.Platform.SortDirection.Ascending); } else { sortProp = new SortProperty(SearchResourceListView.SortExpression, Zentity.Platform.SortDirection.Descending); } //search resources and user permissions on the searched resources. using (ResourceDataAccess dataAccess = new ResourceDataAccess()) { AuthenticatedToken token = this.Session[Constants.AuthenticationTokenKey] as AuthenticatedToken; if (token != null) { foundRestResource = dataAccess.SearchResources(token, searchText, pageSize, sortProp, totalParsedRecords, ContentSearchCheckBox.Checked, out totalRecords).ToList(); userPermissions = GetPermissions(token, foundRestResource); } } //Calculate total pages if (totalRecords > 0) { //this.DisplayMatchedResourcesCount(totalRecords); totalPages = Convert.ToInt32(Math.Ceiling((double)totalRecords / pageSize)); } // Update empty resource's title with default value. if (foundRestResource != null && foundRestResource.Count() > 0) { Utility.UpdateResourcesEmptyTitle(foundRestResource); } //Bind data to GridView SearchResourceListView.TotalRecords = totalRecords; SearchResourceListView.DataSource.Clear(); foreach (Resource resource in foundRestResource) { SearchResourceListView.DataSource.Add(resource); } SearchResourceListView.UserPermissions = userPermissions; SearchResourceListView.DataBind(); if (!this.ContentSearchCheckBox.Checked) { SearchResourceListView.EnableFeed(searchText); } } catch (SearchException ex) { LabelErrorMessage.Text = ex.Message; } } SearchText.Focus(); }