Milan Lund logo

Hi, I am Milan Lund!Freelance Web Developer with Kentico Expertise

I specialize in building and maintaining websites on the Kentico platform.

  • Kentico CMS

How to add a column to UniGrid in Kentico admin

In this post I will show you the way how to add a column to a UniGrid table in Kentico admin on an example of Product coupons.

The problem

Sometimes Kentico doesn't show all needed UniGrids columns in the administration. A good example could be the Product coupons application which doesn't display coupon codes. Let me show you how to add the column Coupon code to the UniGrid that lists coupons.

Find the aspx file that defines the UniGrid

We need to get to know what exactly represents the UniGrid to be able to modify it:

  1. Go to the Modules application > E-commerce.
  2. Switch to the User Interface tab and choose Product coupon in the tree.
  3. In the General tab there is the Target URL field which contains location of the file that defines the UniGrid. In our case it is ~/CMSModules/Ecommerce/Pages/Tools/DiscountCoupons/DiscountCoupon_List.aspx.

Modify the file

We have to tell the UniGrid definition that we need to load the DiscountCouponCode value in data source and add code that represents the column:

  1. Open the file in Visual Studio or any other code editor.
  2. Add DiscountCouponCode to the Columns attibute of the cms:UniGrid tag.
  3. Add the following code inside the GridColumns tag:
Loading...

Add localization string

Value of the Caption attribute in the code above $com.discount.couponcode$ represents a localization string that needs to be translated:

  1. In Kentico admin go to the Localization application and create a new string.
  2. Paste the value in the Key field without the $ characters, add your translation as well. 

That's it. Enjoy!

About the author

Milan Lund is a freelance web developer with expertise in Kentico. He specializes in building and maintaining websites on the Kentico platform. Milan writes articles based on his project experiences to assist both his future self and other developers.

Find out more
Milan Lund