Posts

Showing posts from September 2, 2011

How to create a custom field type in SharePoint 2010 using visual studio 2010?

Image
There are default field types like Text, Note, Boolean, Integer, Number, Decimal, DateTime, Choice, Lookup etc. We can also make our custom field types by using visual studio 2010.
Why Necessary?

For initialization and format field values.
Also used for data validation on user inputs.
Some points to remember:

Field types cannot be deployed in sandbox solution.
Might cause problem with Microsoft office products.
Might cause problem while viewing list items through data grid ir whenever trying to program against list using LINQ.

The structure should look like the below figure:



Steps to create custom field types:
1.     First create a new SharePoint project using the Empty SharePoint project template.

2.   Inside the project you need to add a public class for each custom field type.
3.     You need to add a special xml file namely fldtypes_{project name}.xml, to deploy the field type.
For each custom field type, you must create a field type class that inherits from one of the built-in field type cla…

Create Custom Webparts In Sharepoint 2010

If you’ve ever tried searching the internet for some type of tutorial that walks you through the basics of creating a custom Web part in SharePoint 2010 you’ve probably noticed that most of them are fairly basic. More often than not you’ve mistakenly clicked off to a blog post that’s not even related to SharePoint 2010 Web parts. If this has happened to you, you’ve also probably reached a point where you’ve got one eye on some obscure blog post about 2010, and the other on a forum post pertaining to 2007 all while trying to piece it all together only to really wonder: Am I doing this right? To add more fuel to the fire, have you ever tried to find out how to add custom properties to your Web part? Or perhaps how to add a dynamic dropdownlist control to the Web part properties? It’s almost impossible to find any documentation that walks you through all the necessary steps to do this; to actually get you to the point where you’ve created a Web part that does more than just say “Hello W…