Create View Wizard's scaffolding does not construct View

For the last two weeks, whenever I use the wizard to create a Details, Edit or Create strongly typed view with scaffolding with the wizard, I get an essentially empty view.

All the Edit and Create contain are the BeginForm, the submit, and the back to list link.  Yet just three weeks ago I was able to generate all the fields in the model with the create view wizard when using scaffolding with a strongly typed model and the
Edit or Create template,  I would get a view displaying all of the fields in the model with the proper editor helpers.

This is an example of what I am doing.

  1. I right click on the controller Edit function for which I am creating the view.
  2. I select add view.
  3. I check the the Name in the wizard’s ViewName box so ensure that it is for the proper view (Edit, Create, or Delete).
  4. I check the Create a Strongly Typed View checkbox
  5. I select the model from the model class drop down.
  6. I select the scaffolding template Edit from the Scaffolding template drop down.
  7. I leave the Reference Script Libraries  checkbox checked.
  8. I leave the use layout or master page checkbox checked.
  9. Since the specific Layout page is set in the _ViewStart.cshtml file, I do not show it in the text box.
  10. I click "Add".

Then a n Edit view is created that contains only the Html.BeginForm helper, the submit button and the "Back to List" Action link.

Three weeks ago it properly generated Editor helpers for every field in the model.  But not any more.

Does anyone know what happened?

Hi joeller,

Thank you post the issue to asp.net forum.

It seems your edit template not work good when you select to create editor view.

You can create a new mvc project and try it again see if it works fine in the new project.

Please make sure your EditorTemplate file correctly in your project. Create directory EditorTemplates in Views/Shared and you

should create a view with the same name as the model you want to create the editor for.

http://msdn.microsoft.com/en-us/magazine/ee291528.aspx

Thanks.

Best Regards!

I read Scott’s article. My Common7IDE folder does not have an ItemTemplates folder. All it has is "Script Diagnostics". Any idea where it may be?

Regarding the creation of a directory.  Are you asking me to create the Edit, Create, Display, and Index templates for each controller myself in my project?  As I understand it, the reason for these templates is to make it easy to create the Edit, Create,
Display, and Index views.  If I have to make the templates myself, how is that making it easy?   I may as well just do the views myself.

If the templates are supposed to be in that folder under Common7IDE how do I get that folder?

joeller

If the templates are supposed to be in that folder under Common7IDE how do I get that folder?

Hi joeller,

Thank you for the feedback.

Generately, the template files in below directory.

Microsoft Visual Studio…Common7IDEItemTemplatesCSharpWebMVC 4CodeTemplatesAddViewCSHTML

Thanks.

Fuxiang Zhang – MSFT

Generately, the template files in below directory.

Microsoft Visual Studio…Common7IDEItemTemplatesCSharpWebMVC 4CodeTemplatesAddViewCSHTML

Edward Joell MCSD

My Common7IDE folder does not have an ItemTemplates folder. All it has is "Script Diagnostics". Any idea where it may be?

 

As stated earlier there is no such folder on this machine..

Fuxiang Zhang – MSFT

You can create a new mvc project and try it again see if it works fine in the new project.

It works fine in other MVC projects.  So this behavior is only with this project.

And now to add insult to injury, I can not add a controller to this project.  I get the error "Object reference not set to instance of Object."

Leave a Reply