Basically, for every new Controller I have a Index.cshtml view which is I believe standard behavior for MVC projects. I have three gripes with this practice:
If I have more than one index.cshtml opened in Visual studio, I can't tell which is which by looking at the tab.
When doing a check-in to TFS I have to check folder name to know which Index.cshtml I want to check-in.
In pending changes files are listed alphabetically which means that Index.cshtml will not be next to a controller file and a model file.
Do you find this bothersome or there is a better practice that I'm not aware of?
If I have more than one index.cshtml opened in Visual studio, I
can't tell which is which by looking at the tab.
I hover on the tab to see the path to recognize. Also, many a times I can identify by just viewing the viewbag.title
or the rest of the code.
When doing a check-in to TFS I have to check folder name to know which Index.cshtml I want to check-in.
As per the convention in mvc, the controller searches for the view that should be same as a action in your controller. like Index action
and Index.cshtml
.
If you want to simplify your search, try giving some meaningful names to your view i.e. combination of controllers name and its action. However, this will reflect in the URL/routes which you will have to manage accordingly in the route.config settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With