I have view name Test having a side-nav bar
<div id='sidebar-nav'>
...
<li style="color:black"><a href=@Url.Action("Desc",
"Home",new{id=@obj})>@obj</li>
...
</div>
<div id="div2"></div>
on the click of any of the navbar content link I want the Desc view to load in div 2 How can I do it? I googled It but could not understand much as New to asp.net
You can use jQuery for load div2
.
Example:
<div id='sidebar-nav'>
...
<li style="color:black"><a href='@Url.Action("Desc",
"Home",new{id=@obj})'>@obj</li>
...
</div>
<div id="div2"></div>
<script type="text/javascript">
$(function(){
$("li>a").click(function (e) {
e.preventDefault();
$("#div2").load($(this).attr("href"));
});
});
</script>
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.