Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am pretty new to creating a custom field tupe and I have recently come across a need to create a custom SPLookUPField that allows multiple values. The main requirement is to change the way the control renders its data in Display mode. The Edit mode I would like to keep as is OOTB.

The linked data display should not link to the list item (as the OOTB LookUp does) but link to another link provided in another column in the referenced lookup list for that particular Lookup value and the display should show other columns' information from that list as well.

Is it possible to just change the 'Display Pattern' in the custom Lookup and use the OOTB Edit pattern? If yes, Could someone be grateful to show me how that would be set in code? Would I be overriding the 'DefaultTemplatename' with my own in the Display control mode?

Or is there another way to change the display links on the Lookup column and show more information?

share|improve this question

2 Answers 2

With SPS 2010, all list views are displayed using XSLTListViewWebParts, you can probably try customizing the XSLT and configuring the customized XSLT in the webpart properties.

share|improve this answer

Well, there are two components to your question: The Display/Edit forms, and the List View.

The Display and Edit form controls are provided by your Field's FieldControl. This decides what to render in each of the Display and Edit modes, and always derives from BaseFieldControl. Presumably you'll want to hunt down the MultiLookup derivative, and override it with your own DisplayTemplate. An example of creating a FieldControl can be found here:

Walkthrough: Creating a Custom Field Type

The List View output can be directly created by overriding your Field class' GetFieldValueAsHTML and/or GetFieldValueAsText (2010 only). You'll almost certainly need to alter your Field's XSL to avoid HTML escaping as well.

You could edit the List View rendering via the CAML in your fldTypes... .XML, or directly in the XSL, but I doubt you'd have enough of the lookup list's raw data to hand to do so.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.