简体   繁体   English

使用MVC4中的HTML ActionLink在控制器中加载不同的视图

[英]Load different views in a controller using HTML ActionLink in MVC4

I'm having a problem with loading difference views by using @Html.ActionLink . 我在使用@ Html.ActionLink加载差异视图时遇到问题。 I've attached some screen shots here to explain the problem. 我在此处附上了一些屏幕截图以说明问题。

在此处输入图片说明

when I click on the "Home" button Its loading properly, But when I click on the "Contact" button its load the page but JavaScript, jQuery NOT Working 当我单击“主页”按钮时,其加载正确,但是当我单击“联系”按钮时,其加载页面但JavaScript,jQuery无法正常工作

@{
   Html.Raw("<li class='k-block'>");  

   @Html.ActionLink("Home", "Index", new { controller = "Home" }, new { @class = "k-button" }) 

       Html.Raw("</li>");

   Html.Raw("<li class='k-block'>");  

   @Html.ActionLink("Contact", "Contact", new { controller = "Home" }, new { @class = "k-button" }) 

   Html.Raw("</li>");

在此处输入图片说明

Can you please tell me what would be the mistake I've made.. 您能告诉我我犯了什么错误吗?

Just write it like 就像这样写

@Html.ActionLink("ActionLink", "ActionName","ControllerName" }, new { @class = "ClassName" }) 



@Html.ActionLink("Contact", "Contact","Home" }, new { @class = "k-button" }) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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