[英]Show partial view depends on the calling Action and Controller
As every one know that by default there is a layout page 每个人都知道默认情况下有一个布局页面
when you create project in mvc3 , and also there is a 当您在mvc3中创建项目时,还有一个
partail view which comes by default named _LogOnPartial.cshtml
默认情况下名为_LogOnPartial.cshtml
where login and logout links are availble and it renders on layout page . 登录和注销链接可用并在布局页面上呈现的位置。
I want that when i call home page which is inherited from layout , then 我希望当我调用从layout继承的主页时,
those login and logout links not show on home page 这些登录和注销链接未显示在主页上
...... ......
In short i don't want to render _LogOnPartial.cshtml
when i call home page . 简而言之,我不想在调用主页时呈现_LogOnPartial.cshtml
。
@if (ViewContext.RouteData.Values["Controller"] != "Foo" &&
ViewContext.RouteData.Values["Action"] != "Bar")
{
// call the partial you want here.
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.