I’m using ASP.NET 4.0, jquery and json (very like mvc) and getting a hard time to organize html templates over the project. Sometimes the html templates are built in code behind pages, sometimes it is built in javascript, sometimes in both places (first load and ajax). The truth is, I’m in a big mess, with HTML snippets all over around.
How you guys and girls workaround this problem?
Well, when you work with different languagues, this is hard to avoid, mainly when we talk about client and server side cross information. So, what you can do, is put all html in files in a unique folder. And in client and server side, load this htmls at the point that you want.
–EDIT
You have two ways.
First one, you can have a folder called htmls. So, each html that you need you can put in a html file separated. And in c# or js you load your specific html. (This way i don’t like so much, because you have to load everytime a file, i prefer the second one).
Second, you can have two files, one in js and one in c# with strings properties/attributes. Each property or attribute has you html code that you need, and in you c# you call the properties/attributes that are in the c# file (that has your html codes that you need in your c# code) and the same to the js. (This way, the unique problem that i see is that you have to keep both files (cs, and js) in memory to access as static).