0

I have many webpages on my site that are articles. Each time I create an article, I start by copying a sample file, then replace the placeholder content with the new content.

I am searching for a more automated way of copying the sample file to my project.

Is there a way in ASP.net to store my sample article, then use a command similar to this?

Add -> Add New Item -> My Sample Article Webpage

edt
  • 22,010
  • 30
  • 83
  • 118
  • Why create a separate page for every article? Why not store all the articles in a database, then have one page responsible for retrieving the correct article from the database and displaying the content based on query string or URL segment? – mason Mar 04 '15 at 22:49
  • Yes, you are right mason. Well... to be honest, my example is a bit contrived. In reality, there are several different page types I would like to scaffold and, for some of them, it may not be feasible to add them to a database. – edt Mar 04 '15 at 22:58
  • What you're describing could probably be accomplished with master pages and user controls. But if you truly have a need to do it through the right click new item menu, then that's possible. [this article](http://www.hanselman.com/blog/ModifyingTheDefaultCodeGenerationscaffoldingTemplatesInASPNETMVC.aspx) describes it for MVC. Or [SideWaffle](http://sidewaffle.com/) is a whole project dedicated to making new templates, so you can see how they're doing it. See [their video](https://www.youtube.com/watch?v=naY3jbBNNgY&feature=youtu.be) about making an item template. – mason Mar 04 '15 at 23:03

0 Answers0