MVC5 actionLink将文本框值发送到控制器

时间:2016-10-20 07:06:07

标签: asp.net-mvc

我有文本框

@Html.TextBox("report_id", null, new { @class = "form-control col-md-7 col-xs-12", @Value = @ViewBag.Reports_ID, @readonly = true })

我想使用actionlink将文本框值发送到控制器。但我无法获得文本框值。

@Html.ActionLink("Preview", "Update", "Home", new { @report_id = Request.QueryString["report_id "] }, new { @class = "btn btn-info", target = "_blank" })

请帮忙,谢谢

1 个答案:

答案 0 :(得分:0)

首先为动作链接提供ID属性,如下所示:

npm install

然后为ActionLink编写一个jQuery单击事件函数:

@Html.ActionLink("Preview", "Update", "Home", new { @report_id = Request.QueryString["report_id "] }, new { @class = "btn btn-info", target = "_blank", id="alink" })

看看它是否适合你。