---
title:        "Enabling the Multiple Category Selector in Web Parts"
description:  "If there is one thing in Kentico that I repeatedly forget, it's the fact that the Multiple Category Selector form control by default only works in documents/pages. Fortunately, it is quite easy to tweak the control to be used within web parts/widgets. This post highlights the code to tweak and provides a nuget package for you to play with."
url:          https://www.jeroenfurst.nl/blog/enabling-the-multiple-category-selector-in-web-par
date:         2017-09-01
category:     Web parts and page templates
tags:         [Web parts and page templates]
reading_time: 1
---

# Enabling the Multiple Category Selector in Web Parts

> If there is one thing in Kentico that I repeatedly forget, it's the fact that the Multiple Category Selector form control by default only works in documents/pages. Fortunately, it is quite easy to tweak the control to be used within web parts/widgets. This post highlights the code to tweak and provides a nuget package for you to play with.

Before I start, please let me state that I would never recommend changing the Kentico source code. So please use below steps as reference for the things to adjust in a copy of the default Multiple categories selector form control.
 
 First thing to do is enable the "Multiple categories selector" form control to be used in web parts:
 
 ![Enable form control to be used in web parts](~/getContentAsset/21da88fc-9c82-40e6-91f8-b6b36718a61d/310c1ea5-13ca-4d75-95a0-620f51989b44/2b405b4d_enable-form-control-to-be-used-in-web-parts.PNG.PNG)
 
 *Remember: the multiple categories selector is intended to be only used within page types and it won't work in other places if you don't make additional changes.*
 
 Next change the following code in "CMSModules\\Content\\FormControls\\Categories\\CategorySelector.ascx":

```
<cms:UniSelector ID="selectCategory" runat="server" ReturnColumnName="CategoryName" ObjectType="cms.categorylist" ResourcePrefix="categoryselector" OrderBy="CategoryNamePath"             AdditionalColumns="CategoryNamePath,CategoryEnabled" SelectionMode="SingleTextBox" AllowEmpty="true" IsLiveSite="false" AllowEditTextBox="true" DisabledItems="personal" />
```

to:

```
<cms:UniSelector ID="selectCategory" runat="server" ReturnColumnName="CategoryID" ObjectType="cms.categorylist" ResourcePrefix="categoryselector" OrderBy="CategoryNamePath"            AdditionalColumns="CategoryNamePath,CategoryEnabled" SelectionMode="Multiple" AllowEmpty="false" IsLiveSite="false" />
```

Again, the best way to approach this is to copy the control and create your custom form control. And that's it! 
 
 As promised please find the link to a nuget package containing the custom multiple categories selector form control [here](~/blog-images/TrueLime-Kentico-MultipleCategoriesSelector-1-0-0.nupkg?lang=en-US).
 
 If you wish that this control would be out-of-the-box available then please cast your vote at [Kentico Ideas](http://ideas.kentico.com/forums/239189-kentico-product-ideas/suggestions/20400820-allow-multiple-category-selection-in-listing-and-d).