简体   繁体   中英

Load partial view from partial view

I have a partial view called _LoginPartial and that partial is my loginform. In the bottom of that view is a link called Register, and that obviously leads the user to the register view. As for now that is another view but i just want it to load instead of the _LoginPartial as another partial and i would like it to expand from the _LoginPartial. Is it possible to call a partial to replace the old partial? And how do i make it expand the view and replace the _LoginPartial with _RegisterPartial at the same time.

you can render both partial view in the main view at page load, and if user click register link hide login div and show register form div, and on cancel of register hide register form and show login form, its simple.

Second way is to send ajax call on register link and load register partial view in a container div like this:

<div id="container">
// your login partial view html here with register link at bottom

</div>

Now on click of register get resgister partial view via ajax call and append html in the div with id container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM