views:

30

answers:

1

I'm expanding SPFieldText and BaseFieldControl to create a custom field. The field saves some data externally (for example, on a database or on another list)
Within the control I'm able to handle Edit and New events (using ControlMode).

I'd like to run a function and clean up some data when an item containing my field is deleted. Is this possible, in the context of a custom field?

+2  A: 

No, the field has no "knowledge" of the item it is contained in. You could however perform the cleanup by creating an ItemEventReceiver.

Colin
Yeah, I figured that'd be the case, but I wanted to avoid an event receiver. That's the only option I could think of too, to attach an receiver when I create the custom column. Makes my project even messier `:P` . You're right, though, I don't really have events for creating and editing the item, I only got a control on the page.
Kobi