Display hyperlink to another page as a column in the Document Library Web Part

   —   
You will need to customize the Web Part located in the: \CMSModules\DocumentLibrary\Controls\DocumentLibrary.xml

where you will add your "Link field", e.g.:
<?xml version="1.0" encoding="utf-8" ?> <grid> <columns> <column source="##ALL##" externalsourcename="DocumentName" sort="DocumentName" caption="$general.documentname$" wrap="false" width="100%" /> <column source="DocumentType" externalsourcename="documenttype" caption="Link" wrap="false" /> <column source="DocumentModifiedWhen" externalsourcename="modifiedwhen" caption="$general.modified$" wrap="false"> <tooltip source="DocumentModifiedWhen" externalsourcename="modifiedwhentooltip" /> </column> <column source="##ALL##" externalsourcename="status" caption="$general.workflowstep$" wrap="false" /> </columns> <options> <key name="ShowSelection" value="false" /> </options> </grid>

and then add a small modification (anchor = <a> tag) in the code-behind: \CMSModules\DocumentLibrary\Controls\DocumentLibrary.ascx.cs.  in the method: gridDocuments_OnExternalDataBound add one more case (e.g.: around the line 1080)

case "documenttype":
       return "<a href=\"http://www.kentico.com\">Kentico website</a>";


I've used the DocumentType column just as example, it doesn't influence the content.
Share this article on   LinkedIn

Martin Danko

Let me guide you on your journey of success. I will show you how to optimize your content production with Kentico Draft. Check out www.kenticocloud.com