ASP .NET MVC View Names Conflict

For example, if you would like to render a view in ASP .NET MVC you can call such method

<% Html.RenderPartial(“MyViewName”); %>

The default behavior is to look into a controller view folder and if it is not there look into ‘Shared’ folder. But if you have two identical names in a controller folder and a shared folder and you want to use a shared copy you can do it easily by defining the full path with an extension to the view from the root:

<% Html.RenderPartial(“~/Views/Shared/MyViewName.ascx”); %>

 

Advertisements
This entry was posted in ASP .NET MVC. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s