2

I have a web part which shows items from a list. I want one of the column to be a hyperlink for the item.

Let's say column: First Name, and when user clicks one of the items in a column First Name to redirect him to the full information of the person Ivan(for an example)

2 Answers 2

1
  1. Open the AllItems.aspx page for the specific list on SharePoint Designer
  2. Search for the ViewFields tag
  3. List item LinkToItem="TRUE" to whichever column you want the link:

<ViewFields><br/> <FieldRef Name="LinkTitle"/><br/> <FieldRef Name="linkThisColumn" LinkToItem="TRUE"/><br/> <FieldRef Name="Column 1"/><br/> <FieldRef Name="Column 2"/><br/> </ViewFields><br/>

1
  • I have added it, I tried with linkToItem too,because in some forums I have found that it is causing problems if its with capital L, but still it's not working..
    – Toni
    Commented May 18, 2017 at 14:04
0

I found out that sometimes there are problems with just making linkToItem = "True" in the allItems.aspx.

So I tried the powershell way to do it and the result was positive ! It takes little more time but works perfectly ! Here you can see how to do it :
http://sharing-the-experience.blogspot.bg/2013/05/simple-concept-list-view-how-to-add.html

Sample:

$web = Get-SPWeb siteURL
$list = $web.GetList($web.URL +"URLToTheList\AllItems.aspx")
$Flds = $list.Fields;
$Flds.SchemaXml >> NameTheFileAsYouWant.txt
$Fld = $Flds.getField("TheFieldWhichYouWant")
   /*open NameTheFileAsYouWant.txt. Copy the content over to the notepad.
Add attributes LinkToItem="TRUE" LinkToItemAllowed="Required" 
ListItemMenu="TRUE". 
Replace '"' with '''.Copy content
   */
$Fld.SchemaXml ="{your copied edited field caml}"
$Fld.Update()
$list.Update()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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