views:

141

answers:

2

Hi Everybody,

I have a custom field derived from SPTextField displays EntityEditorWithPicker while in New or Edit mode (I have extended my class from EntityEditorWithPicker). I have added that field as column to a list. When I select any item from the Dialog, it adds that item to the list column. Fine till here. Fine upto this point.

But when I go to Edit any item in the list, it shows the EntityEditorWithPicker on the edit item page but textfield is empty. I want that the value in the list should appear in the textfield in the EntityEditorWithPicker. How can I achieve that.

Thanks in davance for the help.

Best regards,

Asher

A: 

Hi Asher,

We have UpdateEntities() method in EntityEditorWithPicker class (Please note that we need to extend this class for use in our code) that accepts the object of ArrayList. Create EntityPicker Object, populate the Key property (Key property will appear in the Textbox as you want), add EntityPicker object in ArrayList Object and then pass ArrayList Object to UpdateEntities() method. We are done!!!

MyExtendedEntityEditorWithPicker _recordPicker = new MyExtendedEntityEditorWithPicker();
ArrayList entities=new ArrayList();
EntityPicker entity=new EntityPicker();
entity.Key="Value To be Displayed in Textbox";
entities.Add(entity);
_recordPicker.UpdateEntities(entities);

I hope this helps!

Azher Iqbal

Azher Iqbal
A: 

Asher I am trying to do similar. I need the exact funcationality of the Entity with picker but I need my custom field to look up to the user profile and populate other fields on the form. I think your custom field will get me part of the way there.

Can you please post your steps to create the picker, I am relatively new to SP.

Thanks

Darrell

DMB