Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display SharePoint lookup field on publishing website

A page within our MOSS publishing website has a property which is a lookup field.

I only want the selected text to be displayed when you view the page not in edit mode, but when I use the Microsoft.SharePoint.WebControls.LookupField it generates a hyperlink to the SharePoint list item (obviously bad).

Is there a way around this, short of creating my own lookup field control?

like image 364
Aaron Powell Avatar asked Dec 06 '25 17:12

Aaron Powell


1 Answers

You can use a jQuery hack

Using JQuery to remove Linked List Items hyperlinks.

<script type="text/javascript" src="/jquery-1.3.1.js"></script>

<script type="text/javascript">
$(document).ready(function() {
   $('a[href*="RootFolder=*"]').each(
      function(index) {
         var link = $(this);
         $(this).after("<span>" + link.text() + "</span>");
         $(this).remove();
      });
});
</script>
like image 145
Ryan Avatar answered Dec 08 '25 23:12

Ryan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!