Go to main content

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.

How to add a column to UniGrid in Kentico admin

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:
<ug:Column Name="CouponCode" Source="DiscountCouponCode" Caption="$com.discount.couponcode$" Wrap="false" />

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!

Milan Lund

is a freelance web developer and a proud Basenji owner. His specialties are Kentico CMS/EMS and Kentico Cloud.

Further reading

all posts
  • Kentico CMS & EMS

    How to install Kentico step by step

    The Kentico documentation comprehensively describes all the standard ways how to install Kentico on your machine but in a very general way. So there is no step by step tutoria…

  • Front-end & JavaScript

    HTML to BEM tool

    Some time ago I decided not to create any more wild CSS that have no conventions and logic. Instead of that I have chosen to learn and use the BEM methodology that brings structure…

  • Front-end & JavaScript

    Ignored website optimizations

    From time to time people ask me to do a review of their website and give them some recommendation on how to improve performance or maintainability. A very common trend I see is tha…