Lookup field in a Data Form Part Hey everyone!<br><br>I'm having a problem here to which i cannot seem to find the answer. Perhaps you can help.<br><br>I have a list - we'll call it 'articles' - and in that list is a lookup column called 'related articles' that allows a user to select other articles for the same list. When viewing items from this list in the default 'DispForm.aspx', the items in the lookup field are formatted beautifully, each on it's own line and linked to the item. However! When I try to build a custom Data Form Web Part (Or a custom display form even), the items from that field are plain text, with no link, separated by a semi-colon. What gives?! Why are they not linked to the items? Why can I not make that happen????? Anybody know? I've looked into the ddwrt namespace funtions, but none of them seem to apply to my situation. There must be a way to do this. It's very frustrating.<br><br>Any help would be greatly appreciated. Thanks in advance.© 2009 Microsoft Corporation. All rights reserved.Sat, 18 Apr 2009 05:55:11 Zf5ca14c2-925b-4f8d-b306-f7c3d1696be3http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#f5ca14c2-925b-4f8d-b306-f7c3d1696be3http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#f5ca14c2-925b-4f8d-b306-f7c3d1696be3iamaracinghorsehttp://social.msdn.microsoft.com/Profile/en-US/?user=iamaracinghorseLookup field in a Data Form Part Hey everyone!<br><br>I'm having a problem here to which i cannot seem to find the answer. Perhaps you can help.<br><br>I have a list - we'll call it 'articles' - and in that list is a lookup column called 'related articles' that allows a user to select other articles for the same list. When viewing items from this list in the default 'DispForm.aspx', the items in the lookup field are formatted beautifully, each on it's own line and linked to the item. However! When I try to build a custom Data Form Web Part (Or a custom display form even), the items from that field are plain text, with no link, separated by a semi-colon. What gives?! Why are they not linked to the items? Why can I not make that happen????? Anybody know? I've looked into the ddwrt namespace funtions, but none of them seem to apply to my situation. There must be a way to do this. It's very frustrating.<br><br>Any help would be greatly appreciated. Thanks in advance.Wed, 31 Dec 2008 19:37:27 Z2008-12-31T19:37:27Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#26da7f0f-4923-43f0-b7e6-a1c481277c20http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#26da7f0f-4923-43f0-b7e6-a1c481277c20Mike Oryszakhttp://social.msdn.microsoft.com/Profile/en-US/?user=Mike%20OryszakLookup field in a Data Form PartThe data is actually a name/value pair and the standard forms just handle it for you.  For the display you should be able to just code the link and pass in the ID provided.  I've worked with it in custom web parts, data views, etc.  I haven't done a custom data form with one, but I imagine it would be much more difficult than a non-linked field. Wed, 31 Dec 2008 21:34:38 Z2008-12-31T21:34:38Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#b1cee771-aa1c-4a35-99ad-30a0ea34f2dehttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#b1cee771-aa1c-4a35-99ad-30a0ea34f2deiamaracinghorsehttp://social.msdn.microsoft.com/Profile/en-US/?user=iamaracinghorseLookup field in a Data Form Part Thank you so much for the reply!<br><br>Unfortunately, I can't seem to locate the ID for the items in the lookup field. I'm not sure that it's returning that value. I can find the ID for the main item that's displaying, but I think it's only returning the 'Title' field for items in the lookup column. Does that make sense? Can you help mt to find the ID of the individual lookup-field items?Thu, 01 Jan 2009 00:04:23 Z2009-01-01T00:04:23Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#041cf394-3bc8-43b2-91cc-cb64db00d47fhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#041cf394-3bc8-43b2-91cc-cb64db00d47fXue-Mei Chang-MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Xue-Mei%20Chang-MSFTLookup field in a Data Form Part<font face="'Arial','sans-serif'" size=2>Hi,</font> <p style="margin:6pt 12pt 6pt 0cm;line-height:19.2pt;text-align:left" align=left><font face="'Arial','sans-serif'" size=2>I think it is not possible out of the box; there is a workaround for you to get the ID of the list item: create a column in your “articles” list named &quot;lookupID”, and then attach a SPD workflow to the “articles” list, add a action to the workflow “update list item”, update the “lookupID” to the “ID” of “articles” list when the </font><font face="'Arial','sans-serif'" color="#080808" size=2>“related articles” column value is equal to the column that you looked up.</font> </p> <p style="margin:6pt 12pt 6pt 0cm;line-height:19.2pt;text-align:left" align=left><font face="'Arial','sans-serif'" color="#080808" size=2>After this, you can edit the “related articles” column in the data form web part, set its format as “hyperlink”:<br></p> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px"></font><font style="color:blue">&lt;</font><font style="font-size:11px">a  </font><font style="color:red">href</font><font style="font-size:11px">=</font><font style="color:blue">&quot;http://sharepointserver/Lists/articles/DispForm.aspx?ID={@lookupID}&quot;</font><font style="font-size:11px">&gt;<br></font><font style="color:blue">&lt;</font><font style="font-size:11px">xsl:value-of </font><font style="color:red">select</font><font style="font-size:11px">= </font><font style="color:blue">&quot;@related articles&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px">&lt;/</font><font style="font-weight:bold;color:black">a</font><font style="font-size:11px">&gt;    </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td> </td></tr></tbody></table></div> <p style="margin:6pt 12pt 6pt 0cm;line-height:19.2pt;text-align:left" align=left><br><br></font><font style="background:white" face="'Arial','sans-serif'" color=black size=2>Hope it can help you.</font></p> <hr class=sig> Xue-Mei ChangFri, 02 Jan 2009 09:20:49 Z2009-01-02T09:25:45Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#d995f530-e41b-4d2f-9c61-a54fbbccfbbdhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#d995f530-e41b-4d2f-9c61-a54fbbccfbbdiamaracinghorsehttp://social.msdn.microsoft.com/Profile/en-US/?user=iamaracinghorseLookup field in a Data Form Part Thank you, Xue-Mei Chang!<br><br>That solution seems like it would work beautifully if the lookup field only allowed one value, but unfortunately, mine needs to allow multiple values. I'm wondering if your workaround would work for that? I'm thinking it wouldn't.<br><br>This problem seems so strange because it's obviously <em>possible</em> to format these mutiple-value lookup fields as links to the items, as the default DispForm.aspx has them formatted that way. Urgh. Frustrating...Mon, 05 Jan 2009 17:49:23 Z2009-01-05T17:49:23Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#8d83bc7c-b90a-489d-9ed7-1337aaf3b8b5http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#8d83bc7c-b90a-489d-9ed7-1337aaf3b8b5Xue-Mei Chang-MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Xue-Mei%20Chang-MSFTLookup field in a Data Form Part Hi,<br><br>I found another way :<a href="http://blogs.msdn.com/frontpoint/archive/2005/04/15/408672.aspx">http://blogs.msdn.com/frontpoint/archive/2005/04/15/408672.aspx</a><br><br>But I think it is not possible for the multiple value lookup fields.<br><font style="font-size:12px"><font style="font-size:12px">One way that it can be accomplished is by splitting the multivalue string and creating the links manually.</font><br></font> <hr class=sig> Xue-Mei ChangTue, 06 Jan 2009 08:30:35 Z2009-01-06T08:57:33Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#a1843012-a817-4efd-8bee-f52ecdfae824http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#a1843012-a817-4efd-8bee-f52ecdfae824G. Laushinehttp://social.msdn.microsoft.com/Profile/en-US/?user=G.%20LaushineLookup field in a Data Form Part<p>I know a rich text field could have multiple links.<br>One way may be to have code populate that field with the lookup items, formatted with the links.<br>Greg</p>Tue, 06 Jan 2009 20:56:09 Z2009-01-06T20:56:09Zhttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#b8fcf62d-527a-4a06-a9ef-95abc20c275ahttp://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3#b8fcf62d-527a-4a06-a9ef-95abc20c275aquincythttp://social.msdn.microsoft.com/Profile/en-US/?user=quincytLookup field in a Data Form Part<p>After searching for some hours, I found a solution in SharePoint Designer itself.<br><br>Just open the DispForm, right-click the FormField of the column where the lookup hyperlink should be and format the item as List Form Field. <br>The same pull-down menu box as in Edit- and NewForm will appear. Search in the code (split mode and click the form field) for the code from the form field. <br><br>Change <font color="#ff0000">controlmode=</font><font color="#3333ff">&quot;Edit&quot;</font> to <font color="#ff0000">controlmode=</font><font color="#3333ff">&quot;Display&quot;<br><font color="#000000"><br>It worked great for me...<br><br>Good luck on it.<br><br>Kindest regards,<br></font><br><font color="#000000">Quincy Thomas</font><br></font></p><hr class="sig">QTTue, 10 Feb 2009 15:13:05 Z2009-02-10T15:13:05Z