I’ve created two tabs using jquery UI, and placed two partial views in the tabs as the below code.
<div id="tabs">
<ul>
<li><a href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
</ul>
<div id="tab1">
@Html.Partial("Tab1") </div>
<div id="tab2">
@Html.Partial("Tab2")
</div>
</div>
How can I share data from Tab2 partial view to Tab1 partial view.
Thanks,
Naren
You can’t. Directly sharing data between partial views is no good architecture, either. Each partial view should exist for one distinct purpose and should not interfere or exchange data with other ones — in fact,
Tab1shouldn’t even know thatTab2exists.However, you could store the data in the
Modelproperty of the view containing the two partial views and hand that over to each partial view that is rendered: