Re-Scaffold views after changing their model

Alireza Noori picture Alireza Noori · Dec 13, 2013 · Viewed 11k times · Source

I'm using Visual Studio 2013 and ASP.Net MVC 5. I've created a bunch of views for my models and then I've changed them. I want to run scaffolding on some models and create some views automatically and then change the automatically-generated views. Is there another way other than re-naming some files or creating another solution and copying stuff?

Answer

Greg Carrier picture Greg Carrier · Sep 24, 2014

Yes, you can re-scaffold by scaffolding the same model again, using the same model class and controller names as before. Your existing controller and views will be replaced.

Details: Right click on your project or controller folder,

Add ... New Scaffolded Item,

MVC 5 Controller with views using Entity Framework,

Add

Choose your model and data class,

And ensure your controller name is the same as the one to replace.