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
Published Monday, July 02, 2007 10:50 AM by notorioustech

Comments

Monday, August 20, 2007 11:18 AM by 22 Links Today (2007-08-20)

# 22 Links Today (2007-08-20)

Pingback from  22 Links Today (2007-08-20)

Friday, October 05, 2007 6:22 AM by Sanjay

# re: Sample of a custom field control based off of SPFieldMultiColumn

Link for second file PasswordFieldControl.cs is not working!

Friday, October 05, 2007 8:40 AM by notorioustech

# re: Sample of a custom field control based off of SPFieldMultiColumn

Thanks for catching that! All set now.

Thursday, November 29, 2007 3:50 AM by Premachandu Vutla

# re: Sample of a custom field control based off of SPFieldMultiColumn

Very nice one. It helped me out for storing the passwords into a list to farm my connection sring.

Thanks a lot.

Regards,

Premchand.

Leave a Comment

(required) 
(required) 
(optional)
(required)