MVC5 ActionLink的:通过数据作为查询字符串 [英] MVC5 Actionlink: Pass data as query string

查看:94
本文介绍了MVC5 ActionLink的:通过数据作为查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我Html.Actionlink

Following is my Html.Actionlink

@Html.ActionLink("Change Team", "Edit", "UserPlayers", new { MatchId = ViewBag.MatchId, UserId = ViewBag.UserId })

当我运行该应用程序我得到这个

When i run the application I get this

http://localhost:50013/UserPlayers/Edit?Length=11

作为一个链接。

我不从哪里是在长度= 11来了。

推荐答案

您需要添加一个作为最后一个参数:

You need to add a null as the last parameter:

@Html.ActionLink("Change Team", "Edit", "UserPlayers", new { MatchId = ViewBag.MatchId, UserId = ViewBag.UserId }, null)

如果没有这个,你正在使用 Html.ActionLink错误的方法重载()

这篇关于MVC5 ActionLink的:通过数据作为查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆