views:

150

answers:

1

I've developed a series of classes that are called from an asp.net website to create HTML from templates. A pair of the main methods create a pre-styled HTML box. Like so:

<%=ContentBox.DrawTop( title, textColour, backgroundColour )%>

<p>This is the content inside the box</p>

<%=ContentBox.DrawBottom()%>

This code works fine. However in order to draw the HTML box the methods called load a template of the HTML used from an external file. The method then adds in the optional styles from the method parameters ( title, text colour, background colour etc...)

The code I've written exists in the following directory structure:

App_Code\AvonAndSomerset\Admin\UI\class files

So what I've done is put the external text files, used as the HTML templates loaded by the methods in the following directorey structure:

App_Code_Resources\AvonAndSomerset\Admin\UI\Text template files

So my question... Is this an acceptable way to achieve this? Or is there a pre-existing way to store external resources should as these used by App_Code/DLL.

Please bare in mind that I want the external resources to be as easy to view and edit, so not compiled into something none editable.

A: 

You want them to be easily editable which means you can't store them in embedded resources which leaves you with files. Since no conventions really exist in asp.net on where to put content files you just need to create your own convention for your project - you went with App_Code_Resources\AvonAndSomerset\Admin\UI\Text template files which is absolutely fine.

Robert Wilczynski
Glad to hear it :)