Recently I had a requirement to customize the OOB SharePoint search results paging control (SearchPagingWebPart). So below is the problem definition and the solutions I came across. (the link to the downloadable source code for the solution is attached at the end of the post)
OOB paging control gives you several options to specify and define the paging behavior.
Most important properties for me are the first two ones.
1) Maximum page links before current
2) Maximum page links after current
So with the above configuration paging will look like this:
Its fare enough so the current page is 1 and there are no pages to be displayed as previous links. so it will display only 3 after links.
When you navigate to a page in the middle it will look like this:
So its now displaying 4 before links with page numbers and 3 after links.
One of my friend came to me with a question on how to create a SharePoint List Lookup column. He had gone through several approaches (Programmatically and Declaratively) and he was asking for a recommended best practice way. I remembered a bit how I did that before but was not so sure the exact steps. Then I put my hands on and was trying to do a POC and had to spend some time on it. So thought its valuable to blog it so I will have a reference back for my self.
Scenario for my POC was a typical one, Department and Employee Lists. So I want a lookup field inside the Employee list so I can pick Department from a lookup column.
Step 01: Create a list that will contain data for the lookup list. In my case it will be department list and below are the properties of it
List Name = “Departments”
List URL = “Lists/Departments”
Field name that I want to lookup = “Title” Continue reading
I got a requirement to populate two dropdowns with Country and Province/State data for a SharePoint 2007 project (data retrieved from SharePoint lists). So the first dropdown will contain the Country names. Second dropdown should populate details depending on the selected country on first dropdown. In my scenario, if the country is USA then populate the states from USA, and if its Canada, populate the provinces from Canada, if any other country keep the dropdown disabled.
I simple added two asp dropdown controls and bound data respectively of the first dropdown selected index change event. But the issue was for better user experience we had to avoid that post back.
Was reading about how to implement this and because of the reason, possible data for the province/state dropdown is small I went for a jQuery + JSON solution. I could have used a update panel and provided a Ajax solution. But with SharePoint 2007 integrating Ajax is a bit messy and also only because of dropdown data loading for it was a overhead doing that. Continue reading
This post is another continuation of a series of posts related to ECMA Scripting and SharePoint client object model.
ECMAScript Client Object Model – Update a look up field
ECMAScript Client Object Model – Retrieve data from a list
So this time what I’m trying to achieve is to retrieve the values of a list item column. The column is a look up column that brings the data from another list, and the column is a multi select one. So the tricky part is how to iterate through all the lookup values in the specified list item.
Below is the complete ECMAScript for the list item retrieval and then iterating through every item and getting the lookup values.
In a previous post I discussed how to retrieve some values from a SharePoint list and bind it to a drop down list (HTML select). Later I had a requirement update back the selected value of the drop down to another separate list. The values I was retrieving was a lookup field in the second list I wanted to update.
My previous article on retrieve list data : Retrieve Data
So had to spend some time to properly understand how to do the look up field update using client object model.
I added a html button and wrote down a onclick event for the button.
<input type=”button” value=”Submit” onclick=”createListItem();” />
Below is the complete ECMAScript for the new list item update. It contains the two callback functions for successful item creation and failure of item creation. After a successful item creation, the new list item id will be displayed in a alert. Continue reading
I’m starting on SharePoint Online development. So was examining what are the capabilities of ECMAScripts and what we can really achieve. So started simply to read some values from a SharePoint list.
In the below example I’m trying to retrieve list data and populate them inside a drop down.
In the markup I have one Dropdown list that will get populated with the list data, and a button to trigger the event for retrieving data and populating the dropdown.
I have bound the retrieveListItems method to onclick event of the button.
<select id=”ddlCategory”></select> <br />
<input type=”button” value=”GetData” onclick=”retrieveListItems();” />
Then I have written my ECMA Script in a script block as bellow.
When working in Visual Studio we really a lot upon intelisense. Recently I started working on some SharePoint Online related work with ECMA Scripts and was finding very difficult to survive without VS intelisense.
There are many blog posts and articles that illustrate how to enable intellisence in VS for ECMA Scripting. But most of them are not working with Sandboxed solutions and specifically with Sandboxed Visual Web Part (the template comes with SharePoint Power Tools)
So struggling for some time I was able to figure out how to enable it on Sandboxed Visual Web parts.
1) Create the Sandboxed Visual Web Part from the VS Item template. Continue reading