Last post Aug 15, 2017 07:38 AM by Deepak Panchal
Aug 14, 2017 04:30 AM|iforsyth|LINK
Have a simple home page with a header menu on it and body content.
The home page has a link on it to "Register Here," and the link currently redirects to the Account Controller calling the Register Method, an http get method, which simply returns the view the register.cshtml page.
I'd like to do this same thing, except I don't want to totally refresh the entire page when I redirect to register.cshtml. I want the header menu to stay unrefreshed and the body portion of the home page to refresh with the register.cshtml content.
What is the best way to do this redirect only refreshing the body content? I thought of using making the register.cshtml a view component, but I'm not sure how to evoke it from my register link, nor am I sure how to simulate the effect of being redirected
to a new controller and method when the view component is called in the url, e.g. I want the url to change from
www.mydomain.com/Account/Register. Also, when www.mydomain.com/Account/Register is hit directly, I want the body to display the contents of the register.cshtml in lieu of the home page content.
Aug 15, 2017 07:38 AM|Deepak Panchal|LINK
you can try to set the layout.
Common HTML structures such as scripts and stylesheets are also frequently used by many pages within an app. All of these shared elements may be defined in a
layout file, which can then be referenced by any view used within the app. Layouts reduce duplicate code in views
you can refer links below will give you detailed information.
Layouts (Master Pages) in ASP.NET MVC