Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Add Fields to Document Library Web Part Grid View modes: 
User avatar
Member
Member
info@syncworx.com - 1/28/2011 5:54:42 AM
   
Add Fields to Document Library Web Part Grid
Hello All,

We are trying to evaluate the Document Library features. We added a new Field under the CMS.File Document Type nad we want to show this field in the Document Library Grid.

After many research we found that we can define the fields in this file CMS\CMSModules\DocumentLibrary\Controls\DocumentLibrary.xml but we need to know how to write the code in CMS\CMSModules\DocumentLibrary\Controls\DocumentLibrary.ascx.cs to populate the Grid Right.

Appreciate your help and support.
Best regards,

User avatar
Member
Member
kentico_michal - 2/2/2011 3:02:52 AM
   
RE:Add Fields to Document Library Web Part Grid
Hello,

You will need to add your new field into definition of columns that will be selected, so please find gridDocuments_OnDataReload method in ~\CMSModules\DocumentLibrary\Controls\DocumentLibrary.ascx.cs file and add you new field as an input parameter of MergeColumns method:

string string columns = SqlHelperClass.MergeColumns( DocumentHelper.GETDOCUMENTS_REQUIRED_COLUMNS, "NewField, FileDescription, NodeAlias, ...

Last thing you need to do is to add new column into ~\CMSModules\DocumentLibrary\Controls\DocumentLibrary.xml file:

<column source="NewField" caption="NewField" wrap="false" > </column>

Best regards,
Michal Legen