Skip to main content

Posts

Add a custom button to Document Library Items

Recently I created a jQuery add-in that was supposed to add a custom button to each document in the document library. I found 2 different approaches for the same.             1.        Edit XML of the document library in designer.             2.        Create a J Query add-in that would add a custom button. I found Approach 1 to be easy to do but it was risky to modify the XML of the Document library. So the only option that I was left with was to create a j Query add-in. There can be number of requirements for which you may need to add a custom button to document library, lets take an example of adding a custom download a copy button to each item of document library. Below is the code sample that will add a download a button link to your document library <script type="text/javascript" src="//ajax.googleap...

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...

SharePoint Gridview Multi Column filtering and sorting.

SharePoint OOTB grid view allows us to perform multiple filtering and sorting. But when you create a custom solution with SPGridview then implementing multi column filter and sorting is a bit tricky. After a good amount of goggling I found two reliable solutions. Below are two links that helped me as solution. 1.       http://sharethefrustration.blogspot.in/2010/02/spgridview-webpart-with-multiple-filter.html 2.       https://gallery.technet.microsoft.com/office/Multi-Column-Filter-and-6765a863 I used 2 nd link in my solution. Let’s implement an example. Add below code to your designer page. Lets start creating an demo. 1.       Create a new SharePoint Project. 2.       Add a visual webpart into it. 3.       Add html code to create SPGridview.(you can take below code as well) < SharePoint : SPGridView runat ="server" ...