Kentico 10 - Custom filter DataBind issue

Dylan McDonald asked on January 14, 2017 03:30

I've created custom filters numerous times before in previous versions of Kentico. However, in a project I'm working on the CMSAbstractDataFilterControl seems to be calling a DataBind on my child controls (3x LocalizedDropDownLists) after the SetupControls() method gets called. This is causing any ListItems manually inserted into the DropDownLists after I call DataBind() to not appear.

I'm able to get things working as I expect when I move SetupControls() from OnInit to OnPreRender. Did something change between versions and the documentation just hasn't been updated? Do I need to include anything else?

Problematic Code: https://gist.github.com/anonymous/28e4326ba0ceb74dca1db3bdf56e6ba3

Ref: https://docs.kentico.com/k10/custom-development/developing-web-parts/advanced-web-part-development-scenarios/developing-custom-filters

Thanks!

Recent Answers


Trevor Fayas answered on January 16, 2017 16:22

Hopefully support will chime in, but for the time being, you can always put in some extra logic to catch this second databind and prevent it... I'm not sure if the item you are filtering is actually calling the SetupControl as part of it's linking up to it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.