Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# MVC 5链路问题与sub';长度=10';出现_C#_Asp.net Mvc - Fatal编程技术网

C# MVC 5链路问题与sub';长度=10';出现

C# MVC 5链路问题与sub';长度=10';出现,c#,asp.net-mvc,C#,Asp.net Mvc,嗨,我是MVC5的新手,但不是.NETC# 我对@Html.ActionLink有问题 链接在末尾不断添加“长度=10” 这是我的链接 @Html.ActionLink("Reporting", "Reporting", "MenuRouter", new { @class = "Reporting" }, new { hidefocus = "hidefocus" }) 我试着移动东西,但最后还是得到了‘长度=10’ 任何帮助都要感谢Tim试试这个 @Html.ActionLink("Rep

嗨,我是MVC5的新手,但不是.NETC#

我对
@Html.ActionLink有问题

链接在末尾不断添加“长度=10”

这是我的链接

@Html.ActionLink("Reporting", "Reporting", "MenuRouter", new { @class = "Reporting" }, new { hidefocus = "hidefocus" })
我试着移动东西,但最后还是得到了‘长度=10’

任何帮助都要感谢Tim

试试这个

@Html.ActionLink("Reporting", "Reporting", "MenuRouter", null, new { @class = "Reporting", hidefocus = "hidefocus" })

好的,原因是;MVC管道正在尝试通过
actionlink
方法序列化字符串对象

该方法调用以下函数:

public static string ActionLink (this HtmlHelper htmlHelper, string linkText, string actionName, object routeValues, object htmlAttributes)
您最好尝试在控制器上使用
new{}
,尝试以下操作:

@Html.ActionLink("Reporting", "Reporting", new { Controller = "MenuRouter"}, new { @ID = "Repoting" ,  hidefocus = "hidefocus" })     
这肯定会删除
Length=10
,因为没有使用长度声明路由,属性值和名称将被追加,查询字符串参数也将被添加


以上内容将解决您的问题。艾伦

你这么早就搜索过这个了吗?它已经被回答了很多次,@Zabavsky是的,我仍然有很多问题,它在这里出现了很多次,有这么多的解决方案,但无法找到一个可以帮助我的:(我已经修好了now@Zabavsky另外一些我已经看过的是MVC 3和MVC 4,但很抱歉我是新手。谢谢Saranga,我尝试了这种方法,但仍然是一样的问题。@TimDime:真的吗?这很奇怪。我正在我的应用程序中使用它。完美正是我需要的:)谢谢