I have built a custom GridView that binds to user preferences to identify how the grid should be displayed. The idea is that I define the available columns in the database and the user can choose to hide or display various columns. In addition, they can specify the order of the columns and the default sort. All of this is persisted in the database for subsequent sessions.
As I am displaying the same type of data on various web forms, I would like to store the templates in the database with the other column setting info. Then I can dynamically load the templates on all of my pages. Which means I only define the template once.
I found LoadTemplate which loads a template from a control file (ascx), but I would like to load a template from the database. Is this possible? Is there a better option?
I also considered implementing ITemplate myself, but that seemed quite daunting. I don't have a simple example of adding child controls to the template container. Each template could be different and I want to employ the flexibility templates provide. What I really need is the behavior of the ITemplate that the LoadTemplate method produces. I don't want to recreate the wheel.