Skip to main content

Posts

Showing posts from February, 2016

Query SPList’s view, create HTML schema and render on page.

Normally we come across a requirement where we need to provide SharePoint List like UI and facilities to user in our solutions. I came across a good solution where in we query a view of SharePoint List, generate a new custom view and instead of updating default view we just copy the schema HTML and render it to page. It provided me many advantages compared to using SPGrid and writing down code to handle sorting, filtering, paging and many more. The best part I found is Multi column filter and sorting is handled by SharePoint itself. No issues related to paging or UI. Even though I have not tested below solution to extremes, but found it great so decided to document it. Below are solution steps. Create an empty SharePoint Project.   Add a blank webpart to the project.   Create few global properties in the webpart code file. private string listName = "TestList1" ; private string viewFields = "ID,test1,test2,test3" ; private stri