如何将文本框值传递给 @html.hidden() 以转到我的控制器 MVC,我的视图是:
@using (Html.BeginForm("Reject", "Maker", FormMethod.Get))
{
<div class="filed">
<form class="RejectForm">
<p> <input type="text" class="RejectTextBox" name="HidField" id="HidField" value="" placeholder="سبب الرفض">
@Html.ValidationMessage("_strRejectReason", new { @style = "color:red" })</p>
<br />
<input id="RejectButton" type="submit" value="Reject"/>
</form>
</div>
@Html.HiddenFor(model => model._strRejectReason, new { id = "HidField"})
@Html.Hidden("id", item.Id);
<p>@Html.ValidationMessage("CustomError", new { @style = "color:red" })</p>
}
问题是我的控制器接收到模型的一个空对象,该模型包含两个属性 int id ,字符串 _strRejectReason 我使用 @Html.Hidden() 发送它们;但是控制器中的模型对象作为参数是空的,我的控制器是:
public ActionResult Reject(MakerTransactions MakerTransactions)
{
MakerCheckerUnitOfWorkBase _MakerCheckerUnitOfWorkBase = new MakerCheckerUnitOfWorkBase();
MakerTransactions.RouteAgentsConfigsMaker = _MakerCheckerUnitOfWorkBase.RouteAgentsConfigsChecker.RejectMaker(MakerTransactions.id,MakerTransactions._strRejectReason);
return View(MakerTransactions);
}