..:: I like SharePoint ::.. Rotating Header Image


What is a listfielditerator and how can i customize SharePoint listforms?

There are several ways to customize a listform in SharePoint. I wrote already about this topic previously a post serie (three parts). In this post i’d like to show you a different way to create custom list forms. This time i write about the so called listfielditerator and the rendering template.

What is a listfielditerator?

This part of SharePoint is responsible for the outcome of each field. With the field iterator it is possible to change some rendering behaviour as well as using the method isFieldExcluded. This method is used to exclude fields from the form. MSDN Article

What is a rendering template?

A rendering template defines the outcome of the whole aspx page for the listform. By the way, if i talk about listform i mean the display, edit and new form of a list or library. Back to the rendering template which defines the controls that have to be loaded and how they look alike. It also contains the listfielditerator.

Starting point:

First in the solution we need a mapped folder to the controltemplates folder in the 15 Hive of SharePoint. In this folder the ascx file is created to define the rendering template. We have a teamsite, in which are already some lists. We will just create an easy custom list with some columns and change its form.

After that we need a code file (.cs) in which create a class which inherits from Listfielditerator. Let’s see the details:


SharePoint Override save button in list form by using csharp

Well i a custom list form you always have a cancel and a save button. I already posted how to create & deploy custom list forms. But i didn’t mentioned that it is possible to override the save handler. That’s pretty useful if you want to do some extra action after the user clicks on the save button, or if you need to write some data of the form to an external system.

Well my other post are here:

Part 1: Setting up a solution with a list definition, a list instance and deploy it.

Part 2: Creating a custom list form and connect it with the list definition.

Part 3: Necessary settings for custom listform in Visual Studio

Cause i didn’t told you how to overwrite the save button in order to do some custom actions on this part i’ll do it now. It’s really simple. See the code below:


//In your aspx page a control like this should be available

<sharepoint:savebutton   runat="server" ControlMode="New"  ID="savebutton" ></sharepoint:savebutton>


//Override Save Button in the init method
protected override void OnInit(EventArgs e)

//In the init method you overrite the event handler for saving with your save button action
SPContext.Current.FormContext.OnSaveHandler += new EventHandler(mySaveHandler);


//My Save Button Function
protected void mySaveHandler(object sender, EventArgs e)

//you can validate the page if you like
if (Page.IsValid)
//Do whatever you wanna do
SPListItem currentItem = SPContext.Current.ListItem;


That’s it. Really easy right?


SharePoint list schema force checkout & checkin

If you creating a list definition and you want the list to force the user to checkin & checkout listitems, you can do this by adding this attribut ForceCheckout=”True”

You put it in the <List> tag at the beginning. It will say that it is not declared attribute, but it will work. Try it yourself.



SharePoint 2013: Tokens for Custom Action

Today i searched for some examples of using item properties in Custom Action and i found this link: http://msdn.microsoft.com/en-us/library/office/ms431831.aspx

There you will find a short overview of URL tokens in SharePoint 2013. An example of using Custom Actions will be available soon.

Tokens for Custom Action:

{ItemId} The ID of an item in a list or library (an integer).
{ItemUrl} The URL of the item being acted upon.
{ListId} The ID of the current list (a GUID).
{RecurrenceId} The recurrence index of a recurring event.
{Site} The URL of the current website.
{SiteCollection} The URL of the parent site of the current website.
{SiteUrl} The URL of the current website.
{Source} The HTTP Request URL.

SharePoint create custom list forms with Visual Studio Part 3

This is the third part of my post serie. In this post serie i would like to share my experience with custom list forms in SharePoint 2010 and 2013. Normally you start a visual studio solution with a list definition and a list instance. These posts will show you step by step to add a custom list form which will work fine even with code behind.

Part 1: Setting up a solution with a list definition, a list instance and deploy it.

Part 2: Creating a custom list form and connect it with the list definition.

Part 3: Necessary settings for custom listform in Visual Studio

In post 2 we created our custom list form and it worked. It was based on the posts i mentioned. But there was something what throws an exception that was not mentioned anywhere along with custom forms.

Let’s make a test. After you followed part 1 und part 2 and you successfully deployed your custom list with a custom display form, you now should make any modifications to the masterpage. Anything, it does not matter what. I did it and the result is the following exception:


Ok, what? Base type not safe?

I checked it, if you now reset your masterpage to web site definition, the error dissappears.

Tip: Do not modify your masterpage or read on! (more…)