what is layout indicates in view page.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hello, I want to know that what is layout in view page of nopcommerce which given the path of other view page. But if I remove that layout then also there is no change in nopcommerce.

like in index.cshtml there is Layout = "~/Views/Shared/_ColumnsOne.cshtml";

Now, my question is that why this other cshtml path has given and if I remove this line then there is no change in nopcommerce.

Please help me to solve this issues.

Thank You.
6 years ago
sksoni wrote:

Hello, I want to know that what is layout in view page of nopcommerce which given the path of other view page.


Hi Karan,

Layout page is a concept of ASP.NET MVC and not of nopCommerce, I would like to rephrase your sentence. It is not gives you a path of another view page but that's indicate Master Page of your current view.  

sksoni wrote:

like in index.cshtml there is Layout = "~/Views/Shared/_ColumnsOne.cshtml";

Now, my question is that why this other cshtml path has given and if I remove this line then there is no change in nopcommerce.


Now, the question is if you removed it from _ColumnsOne.cshtml then why it doesn't affect any!!

If you observe there is a view page (_ViewStart.cshtml) at Nop.Web > Views. Which has code as below.


@{
    Layout = "~/Views/Shared/_ColumnsOne.cshtml";
}


_ViewStart.cshtml that which one is our default master layout. if you removed from here, it will appear changes to front side.

_ViewStart.cshtml is concept of MVC. Razor View Engine introduced a new layout named _ViewStart which is applied on all view automatically. Razor View Engine firstly executes the _ViewStart and then start rendering the other view and merges them.
    

Hope this helps!
6 years ago
sksoni wrote:
Hello, I want to know that what is layout in view page of nopcommerce which given the path of other view page. But if I remove that layout then also there is no change in nopcommerce.

like in index.cshtml there is Layout = "~/Views/Shared/_ColumnsOne.cshtml";

Now, my question is that why this other cshtml path has given and if I remove this line then there is no change in nopcommerce.

Please help me to solve this issues.

Thank You.


if you want to understand layout of nopCommerce please find below documentation :
https://docs.nopcommerce.com/pages/viewpage.action?pageId=1442511
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.