Showing posts with label Filter. Show all posts
Showing posts with label Filter. Show all posts

Wednesday, February 22, 2017

Scroll to top of the page after Pagination or Refinement in SharePoint 2013 search results

Hi Friends,

In SharePoint out of the box search results, the paging control will be under the Search results. In this case, whenever there is paging happened the SharePoint will keep the page remained at the bottom though it moved to next set of results. This make users to scroll up the page in order to see the next set of results.


We can overcome this approach using "ScrollToTopOnRedraw” property in Search results webpart. This is a hidden property which will not be visible in Edit webpart properties UI. However this change can be done by modifying the  .webpart file.

"ScrollToTopOnRedraw" is a boolean property which is false by default and all we need to do is, setting this property true.

Please find the below steps

1) Export your current search results webpart to get .webpart file

2) Open it in a text editor or Notepad

3) Find the property “ScrollToTopOnRedraw” and change its value from False to True and Save the file.

4) Import the webpart and add it in your page.

Thats All. The page scrolls to top whenever there is pagination or refinement.

Hope this helps...

Thursday, January 12, 2012

How to filter a DataTable using LINQ

Hi Friends,

In this post we are going to Filter a DataTable using LINQ.

We can filter a DataTable in many ways but using LINQ is the best and recommended approach..
In the below code snippet we are going to filter the datatable and then assign the results back to it.

Below are the assumptions before you jump into the code.
  • dtMainTable is the DataTable which you got it from your logic.

var tempTable = from DataRow dataRow in dtMainTable.Rows
                                    where dataRow["ColumnName"] == "Value"
                                    select dataRow;
                    if (tempTable.Count() > 0)
                    {
                        dtMainTable= tempTable.CopyToDataTable();
                        dtMainTable.AcceptChanges();
                    }

Hope this helps...

Popular Posts