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 see this difference when I'm working with lists in Data View Web Parts and manipulating the values in XSL. Why do some Lookup column values look like '1;#text' and others just have the text? I've never been able to figure that out.

It may have something to do with the Site Definition, but I'm just guessing. I've seen this difference in both SharePoint 2007 and 2010.

Right now I'm working in 2007, with lookups to Title columns in other lists. In this case, I don't have the ID;#. It seems to be consistent within installations.

Generally speaking, I would always prefer to see the ID;#, as I can then do much more reliable matching in my AggregateDataSources than if I have to use the text values.

share|improve this question
    
I've never seen one without the delimiter. When are you seeing these? Or where? Do you have examples? –  RJ Cuthbertson Jul 31 '12 at 14:19
    
I added some clarification above. –  Marc D Anderson Jul 31 '12 at 14:25
    
If you access the same LookUp column from the server object model does it return the same value? –  RJ Cuthbertson Jul 31 '12 at 14:28
    
I've seen sharepoint.stackexchange.com/questions/13201/… and jeevansd.blogspot.com/2012/03/… about DVWP returning a link to the column. –  RJ Cuthbertson Jul 31 '12 at 14:29
    
Can you do a "GetList" call on the list that is affected and a list that isn't? Maybe comparing the fields, something may show up in there. –  iOnline247 Jul 31 '12 at 14:30

2 Answers 2

From what I've read about LookUp columns and DVWP, in DVWP (and only in DVWP) LookUp columns get returned as a link to the column and the actual value (rather than the delimited value).

The data stored in the SPListItem still has the delimited value internally. It is not however surfaced in the DVWP.

It's just an illusion that the data is not stored as such.

See:

Inserting Lookup columns into Data View Web part displays as XML

http://codeforfuture.com/2011/03/15/how-to-remove-link-for-sharepoint-lookup-column-from-a-dataview-webpart-using-xslt/

http://jeevansd.blogspot.com/2012/03/removing-link-from-lookup-column-in.html

share|improve this answer
    
I added yet more info above. I'd really like to always see the ID;#. –  Marc D Anderson Jul 31 '12 at 14:59
    
But that's not how the DVWP works. The data is stored internally like you want it, but the DVWP renders it like you're seeing it. It's a behavior of the DVWP not the SPListItem. –  RJ Cuthbertson Jul 31 '12 at 15:00
    
Your question is "Why is it like this?" This is the answer. –  RJ Cuthbertson Jul 31 '12 at 15:01
    
I think you're answering a different question than I'm asking. I'm writing my own XSL in the DVWP, not just clicking on buttons in the ribbon. In some environments I see the ID;# in lookup column values and in others I don't. I'm wondering why there;s a difference. –  Marc D Anderson Jul 31 '12 at 15:24

Use this:

<xsl:value-of select="substring-after(@Manufacturer.,'#')"/>

instead of

<xsl:value-of select="Manufacturer."/>

for the look up column

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.