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:
- Go to the Modules application > E-commerce.
- Switch to the User Interface tab and choose Product coupon in the tree.
- 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:
- Open the file in Visual Studio or any other code editor.
- Add DiscountCouponCode to the Columns attibute of the cms:UniGrid tag.
- 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:
- In Kentico admin go to the Localization application and create a new string.
- Paste the value in the Key field without the $ characters, add your translation as well.

That's it. Enjoy!
Further reading
all posts- Kentico Xperience
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…