Kentico CMS Quick Tip - Use ClientIDMode Appropriately
A few of my fellow developers were recently inspired by one of the newer knowledge based articles post over on Kentico DevNet about how to serve less HTML code from a Kentico web part. While their intentions were good they forgot one golden rule of correctly utilizing ASP.NET controls that involve PostBacks. It took me awhile to figure out why none of the Edit and Delete buttons were working as expected on each row of the UniGrid. I am sharing this quick story today to hopefully save some time for other Kentico developers out there.
What they did was follow the article's suggestion to set the ClientIDMode property of the control, in this case the UniGrid control, to Static. Changing this setting does indeed allow for the id of the control to be nicely controllable, and also allow it to render out a clean id. My colleagues did this because they wanted to apply some jQuery code to move an element around in the header row of each column in the grid and change up some style rules dynamically. The change to the property value had the desired effect, and everything worked, well almost everything worked.
Changing the property value like the following example:
<cms:UniGrid runat="server" ID="gridElem" ClientIDMode="Static" ... />