我正在尝试将用户从SolicitantesController
上的这个视图重定向到ExpedientesController
Create
上的视图:
@model Entrega02Programacion03.Models.Solicitante
@{
ViewBag.Title = "InformeSolicitante";
}
<h2>InformeSolicitante</h2>
<div>
<h4>Solicitante</h4>
<hr />
<dl class="dl-horizontal">
<dd>Cedula: @ViewBag.Cedula </dd>
<dd> Nombre: @ViewBag.Nombre</dd>
<dd>Apellido: @ViewBag.Apellido</dd>
<dd>Email: @ViewBag.Email</dd>
<dd>Tel: @ViewBag.tel</dd>
</dl>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Crear Expediente" class="btn btn-default" />
</div>
</div>
</div>
这是关于solicitantesController
的帖子,但我无法Crear Expediente
我的按钮到达那里,对我可能做错了什么有什么想法吗?谢谢
[HttpPost]
public ActionResult InformeSolicitantes()
{
return RedirectToAction("Expedientes", "Create");
}
我建议两种解决方案来解决它:
1(将提交html控件替换为锚链接与InformeSolicitantes操作URL并删除[HttpPost]
例如替换
<input type="submit" value="Crear Expediente" class="btn btn-default" />
跟
<a class="btn btn-default" href="action path/name"></a>
然后删除
[HttpPost]
2(将输入控件放入表单控件中,并设置表单操作和控制器以点击InformeSolicitantes操作。
例如替换
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Crear Expediente" class="btn btn-default" />
</div>
</div>
跟
<form action="action path/name" method="post"><div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Crear Expediente" class="btn btn-default" />
</div>
</div></form>