Creating a DNN Module that uses a end-user modifyable template
-
09-06-2019 - |
Question
I'd like to create a module in DNN that, similar to the Announcements control, offers a template that the portal admin can modify for formatting. I have a control that currently uses a Repeater control with templates. Is there a way to override the contents of the repeater ItemTemplate, HeaderTemplate, and FooterTemplate properties?
Solution
That are many different ways that you can accomplish this, typically the best/easiest manner is to simply put a literal control in for Header, Footer, and Item templates. Then handle the ItemDataBound event, you can look at the item type and take a specific action on it there to load the needed data.
If you want to see some implementations of this model, you can download the code for my Expandable Text/HTML module, as well as my Guesbook Module both available for free, without login at http://www.iowacomputergurus.com
OTHER TIPS
You can see examples of templating in the default Starertkit module, the FAQ module, repository module and UDT. All of these have varying levels of control for templating.