One of my recent SharePoint projects involved creating a custom field type – essentially an ASP.NET user control – which is then able to be included in a SharePoint content type, or used as a type when creating a site column.
The business logic stated that “certain users” could edit the metadata field value – and others couldn’t – but just for ONE field.
The custom field type needed to include a textbox that could be enabled/disabled – and a button to execute some other code (to validate the value entered).
Again – if the user was not able to edit, then the button would be invisible.
After creating the SharePoint custom field field type, I was then able to create a column using the “type” – and then include it in the Content Type for the site, with the custom business logic included within.
The following post was AWESOME with respect to a sample/tutorial, and worth a mention – for other SharePoint dev’ers out there – and for ME – for later reference…
Just had to follow the same steps as described in the article, and then changed the functionality and user interface to suit my needs :
- Open Visual Studio
- Create a user control (ASCX), with a “SharePoint:RenderingTemplate”
- Create a class file (CS) for the business logic – in my case, to check if the current user role was in a particular group (from a web.config setting)
- Create another class file (CS) for the SharePoint custom field definition
- Create the necessary XML files – and install to GAC + 12-hive
Click here to read the full article from Nick Sevens – with some code samples to copy & paste.
Source : Nick’s SharePoint Blog
Thanks Nick !!