C# ActionLink CS1026:)预期为

C# ActionLink CS1026:)预期为,c#,asp.net,asp.net-mvc,C#,Asp.net,Asp.net Mvc,每当我尝试使用ActionLink时,就会出现上述错误?我只是刚刚开始玩MVC,并不真正理解代码的问题(如下所示): 这似乎是一个解析问题,但只有在我运行页面时才会发生。应用程序构建得非常好,所以我真的不明白,因为这个错误是编译错误?如果我把第25行拿出来,它会发生在下一行 Compilation Error Description: An error occurred during the compilation of a resource required to service thi

每当我尝试使用ActionLink时,就会出现上述错误?我只是刚刚开始玩MVC,并不真正理解代码的问题(如下所示):


这似乎是一个解析问题,但只有在我运行页面时才会发生。应用程序构建得非常好,所以我真的不明白,因为这个错误是编译错误?如果我把第25行拿出来,它会发生在下一行

 Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1026: ) expected

Source Error:

Line 23:   </div>
Line 24:   
Line 25:   <%= Html.ActionLink("Lists", "Index", "Lists"); %>
Line 26:   <a href="<%= Url.Action("/", "Lists"); %>">Click here to view your lists</a>
Line 27:   


Source File: d:\Coding\Playground\HowDidYouKnowMVCSoln\HowDidYouKnowMVC\Views\Home\Index.aspx    Line: 25 
编译错误
描述:编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码。
应为编译器错误消息:CS1026:)
源错误:
第23行:
第24行:
第25行:
第26行:
第27行:
源文件:d:\Coding\playway\howdyYouknowMVCSoln\howdyYouknowMVC\Views\Home\Index.aspx行:25

使用时不带尾随分号:

<%= Html.ActionLink("Lists", "Index", "Lists") %>

从ActionLink行中删除分号

注意:当使用
时,没有分号,代码应该返回一些东西,通常是字符串。当使用
时,即百分比后不等于,代码应返回void,并且在收盘百分比前需要分号


例如,当使用Html方法时,VS intellisense将告诉您它是否返回void。如果是这样,请不要使用等号并以分号终止。

在我的情况下,我真的错过了)在ActionLink的末尾

<%= Url.Action("SearchPatientSchedules", "PatientSchedules" **)** %>

被评估,被执行是我想记住的方式。
<%= Url.Action("SearchPatientSchedules", "PatientSchedules" **)** %>