CMSDocumentComparison

The CMSDocumentComparison control allows you to display several documents in table columns for comparison. This control is useful if you want to compare parameters of various products. The user can add the available documents to the comparison table and remove selected displayed documents from the comparison.

 

CMSDocumentComparison control uses the BasicMultiColumnTable control.

 

 

Data Source

 

Kentico CMS documents specified using standard properties (Path, ClassNames, etc.).

 

 

Inherits: CMSControlProperties - common properties

 

 

Properties

 

Property Name

Description

Sample Value

AddButton

Add button control.

 

BasicMultiColumnTable

BasicMultiColumnTable control instance.

 

DocumentList

Drop-down list with all comparable documents.

 

DropDownListColumn

Column to be displayed in the drop-down list.

"ProductName"

RemoveAllText

Text of the link for removing all compared documents.

"Remove all"

RemoveText

Text of the link for removing selected document.

"Remove"

TableParams

See BasicMultiColumnTable

 

TagKey

Overrides the generation of the SPAN tag with custom tag.

 

 

 

Design

 

See BasicMultiColumnTable for details on design.

 

You can also modify the properties of the appropriate controls (BasicMultiColumnTable, AddButton, DocumentList).

 

 

Example

 

This example will show you how to display a product comparison.

 

1.Create a new web form.

 

2.Drag and drop the CMSDocumentComparison control on the form. Set the following properties:

       - ClassNames="cms.product"
       - Path="/Products/%"
       - DropDownListColumn="ProductName"

 

3.Add the following code to the Page_Load method:

 

[C#]

 

// define table rows

string[,] tableParameters = new string[4, 4];

tableParameters[0, 0] = "Product:";

tableParameters[0, 1] = "ProductName";

tableParameters[1, 0] = "Description:";

tableParameters[1, 1] = "ProductDescription";

tableParameters[2, 0] = "Price:";

tableParameters[2, 1] = "ProductPrice";

tableParameters[2, 2] = "USD {%ProductPrice%}";

tableParameters[2, 3] = "N/A";

this.CMSDocumentComparison1.TableParams = tableParameters;

 

// set CSS styles

this.CMSDocumentComparison1.BasicMultiColumnTable.TableFirstRowCellCSSClass = "MulticolumnTableFirstRow";

this.CMSDocumentComparison1.BasicMultiColumnTable.TableFirstColumnCellCssClass = "MulticolumnTableFirstColumnCell";

 

[VB.NET]

 

'define table rows

Dim tableParameters(3, 3) As String

tableParameters(0, 0) = "Product:"

tableParameters(0, 1) = "ProductName"

tableParameters(1, 0) = "Description:"

tableParameters(1, 1) = "ProductDescription"

tableParameters(2, 0) = "Price:"

tableParameters(2, 1) = "ProductPrice"

tableParameters(2, 2) = "USD {%ProductPrice%}"

tableParameters(2, 3) = "N/A"

Me.CMSDocumentComparison1.TableParams = tableParameters       

 

'set CSS styles

CMSDocumentComparison1.BasicMultiColumnTable.TableFirstRowCellCSSClass = "MulticolumnTableFirstRow"

CMSDocumentComparison1.BasicMultiColumnTable.TableFirstColumnCellCssClass = "MulticolumnTableFirstColumnCell"

 

 

What you did

 

You have specified the rows of the BasicMultiColumnTable control and styles.

 

4.Compile and run the project. You should see a page like this:
 
clip0009