Sample of a custom field control based off of SPFieldMultiColumn
here is a useful sample - a password box that hides the typed in password.
The files are Password.Field.cs and Password.FieldControl.cs
Just add to a project, change the namespace, sign the dll and create the field.xml file and you are good to go.
In developing MANY custom field controls I have noticed some bugs/quirky behaviour to watch out for, maybe it's just me but I will note them here anyways:
-
Default Properties as specified in the fields.xml file are not displayed correctly when editing an already created field. When you add a field to a list you can set the custom properties fine, but when you reopen that field/column to edit it shows the value in that custom property to be some bogus statement. If you then resave the field it will overwrite what you put in the first time with that garbage. So you have to remember what you put and and re-enter it everytime you want to edit the field.
-
Required Field settings do no work when set on content type and not field itself - it displays on the form as required with the red asterisk but if you examine the Required property of the control it is always false. Looking into this now.
Del.icio.us |
Digg It |
Technorati |
Blinklist |
Furl |
reddit |
DotNetKicks