I have the need to expand an asp.net 2.0 web application that I recently created. Currently there is a single page that contains some embedded HTML that is needed in a separate section of the application in a new page that I am working on. On this new page, I am going to be using the HTML multiple times throughout the page, mostly duplicating the HTML with JavaScript/jQuery. So I am not sure if I want to have the HTML in a JavaScript variable or hidden in the page and then call $.clone() on the HTML to dynamically recreate it.
Is there a way to have shared HTML files within an asp.net 2.0 forms web application so that I do not have to complete dual maintenance of code; I assume similar to the way that an MVC application would work (although I am not completely familiar with how MVC HTML works).
Create it as a User Control if it’s only ever going to be deployed within a single project – otherwise you would have some duplication of effort with versioning. If that’s the case, re-create it as a server control and emit the HTML/JS from there; server controls can be shared across projects from their own library. You’ll only need to maintain one copy.