0
votes

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

1

1 Answers

0
votes

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