我有一个用 MVC3 (VB.NET) 制作的系统,它工作正常。我正在尝试将此系统升级到 MVC4(Beta),除了 HttpPost 之外一切正常。
这是视图代码(剃刀):
@Using Html.BeginForm()
@<fieldset>
<legend></legend>
<br />
<fieldset>
<legend>Datos Generales</legend>
<table>
<tr>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.IDCertificado)
@Html.TextBox("ID_CERTIFICADO1", "Automático", New With {.readonly = "readonly", .style = "width:90px; text-align:center", .class = "letraingreso"})
</td>
<td style="width:20px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.IDPoliza)
@Html.DropDownListFor(Function(Model) Model.IDPoliza, Nothing, New With {.style = "width:200px; visibility:visible", .class = "letraingreso"})
</td>
</tr>
<tr>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.IDCampaña)
@Html.DropDownListFor(Function(Model) Model.IDCampaña, Nothing, New With {.style = "width:250px; visibility:visible", .class = "letraingreso"})
</td>
<td style="width:20px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.IDVigencia)
@Html.DropDownListFor(Function(Model) Model.IDVigencia, Nothing, New With {.style = "width:183px; visibility:visible", .class = "letraingreso", .disabled = "disabled"})
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset>
<legend>Datos del Certificado</legend>
<table width="99%">
<tr>
<td style="border-width:0px; border-style:solid; width:8%">
@Html.LabelFor(Function(Model) Model.FechaEmision)
</td>
<td style="border-width:0px; border-style:solid; width:11%">
@Html.TextBox("FechaEmision", Nothing, New With {.style = "width:80px; text-align:center", .class = "letraingreso", .readonly = "readonly"})
</td>
<td style="width:1%"></td>
<td style="border-width:0px; border-style:solid; width:8%">
@Html.LabelFor(Function(Model) Model.FechaInicioVigencia)
</td>
<td style="border-width:0px; border-style:solid; width:12%">
@Html.TextBoxFor(Function(Model) Model.FechaInicioVigencia, New With {.maxLength = "10", .onkeyup = "DateFormat(this, this.value, event, false, '3')", .onblur = "DateFormat(this, this.value, event, true, '3')", .style = "width:80px", .class = "letraingreso"})
<a href="#"><img src="@Url.Content("~/Images/spacer.gif")" class="imagenfecha" style="border:0" height="16px" width="20px" id="imgFechaInicioVigencia" alt="" /></a>
<script type="text/javascript">
Calendar.setup(
{
inputField: "FechaInicioVigencia",
ifFormat: "%d/%m/%Y",
button: "imgFechaInicioVigencia",
align: "Tl",
singleClick: true
});
</script>
</td>
<td style="width:1%"></td>
<td style="border-width:0px; border-style:solid; width:25%">
@Html.LabelFor(Function(Model) Model.FechaFinVigencia)
@Html.TextBoxFor(Function(Model) Model.FechaFinVigencia, New With {.maxLength = "10", .onkeyup = "DateFormat(this, this.value, event, false, '3')", .onblur = "DateFormat(this, this.value, event, true, '3')", .style = "width:80px", .class = "letraingreso"})
<a href="#"><img src="@Url.Content("~/Images/spacer.gif")" class="imagenfecha" style="border:0" height="16px" width="20px" id="imgFechaFinVigencia" alt="" /></a>
<script type="text/javascript">
Calendar.setup(
{
inputField: "FechaFinVigencia",
ifFormat: "%d/%m/%Y",
button: "imgFechaFinVigencia",
align: "Tl",
singleClick: true
});
</script>
</td>
</tr>
<tr>
<td style="border-width:0px; border-style:solid; width:8%">
@Html.LabelFor(Function(Model) Model.IDEstado)
</td>
<td style="border-width:0px; border-style:solid; width:11%">
@Html.DropDownListFor(Function(Model) Model.IDEstado, Nothing, New With {.style = "width:100px; visibility:visible", .class = "letraingreso", .disabled = "disabled"})
</td>
<td style="width:1%"></td>
<td colspan="5" style="border-width:0px; border-style:solid; width:13%">
@Html.LabelFor(Function(Model) Model.IDPlanGrupoCobertura)
@Html.DropDownListFor(Function(Model) Model.IDPlanGrupoCobertura, Nothing, New With {.style = "width:350px; visibility:visible", .class = "letraingreso"})
</td>
</tr>
</table>
</fieldset>
<br />
<div id="tabs">
@*Establece los tabs a ser creados*@
<ul>
<li><a href="#fragment-1"><span>Asegurado</span></a></li>
</ul>
@*Asegurados*@
<div id="fragment-1">
<table>
<tr>
<td style="border-width:0px; border-style:solid; width:58px">
@Html.LabelFor(Function(Model) Model.IDAsegurado)
</td>
<td style="border-width:0px; border-style:solid">
@Html.TextBox("IDAsegurado", "Automático", New With {.readonly = "readonly", .style = "width:80px; text-align:center", .class = "letraingreso"})
</td>
<td style="width:10px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.IDTipoDocumentoAsegurado)
@Html.DropDownListFor(Function(Model) Model.IDTipoDocumentoAsegurado, Nothing, New With {.style = "width:200px; visibility:visible", .class = "letraingreso"})
</td>
<td style="width:10px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.NumeroDocumentoAsegurado)
@Html.TextBoxFor(Function(Model) Model.NumeroDocumentoAsegurado, New With {.onkeyup = "if(this.value.match(/\D/))this.value=this.value.replace(/\D/g,'')", .class = "letraingreso", .style = "width:100px"})
</td>
<td style="width:10px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.FechaNacimientoAsegurado)
@Html.TextBoxFor(Function(Model) Model.FechaNacimientoAsegurado, New With {.maxLength = "10", .onkeyup = "DateFormat(this, this.value, event, false, '3')", .onblur = "DateFormat(this, this.value, event, true, '3')", .style = "width:80px", .class = "letraingreso"})
<a href="#"><img src="@Url.Content("~/Images/spacer.gif")" class="imagenfecha" style="border:0" height="16px" width="20px" id="imgFechaNacimientoAsegurado" alt="" /></a>
<script type="text/javascript">
Calendar.setup(
{
inputField: "FechaNacimientoAsegurado",
ifFormat: "%d/%m/%Y",
button: "imgFechaNacimientoAsegurado",
align: "Tl",
singleClick: true
});
</script>
</td>
</tr>
</table>
<table>
<tr>
<td style="border-width:0px; border-style:solid; width:58px">
@Html.LabelFor(Function(Model) Model.NombresAsegurado)
</td>
<td style="border-width:0px; border-style:solid">
@Html.TextBoxFor(Function(Moel) Model.NombresAsegurado, New With {.style = "text-transform:uppercase; width:270px", .class = "letraingreso"})
</td>
<td style="width:15px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.PrimerApellidoAsegurado)
@Html.TextBoxFor(Function(Model) Model.PrimerApellidoAsegurado, New With {.style = "text-transform:uppercase; width:182px", .class = "letraingreso"})
</td>
<td style="width:15px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.SegundoApellidoAsegurado)
@Html.TextBoxFor(Function(Model) Model.SegundoApellidoAsegurado, New With {.style = "text-transform:uppercase; width:182px", .class = "letraingreso"})
</td>
</tr>
</table>
<table>
<tr>
<td style="border-width:0px; border-style:solid; width:58px">
@Html.LabelFor(Function(Model) Model.IDCiudadAsegurado)
</td>
<td style="border-width:0px; border-style:solid">
@Html.DropDownListFor(Function(Model) Model.IDCiudadAsegurado, Nothing, New With {.style = "width:180px; visibility:visible", .class = "letraingreso"})
</td>
<td style="width:15px"></td>
<td style="border-width:0px; border-style:solid">
@Html.LabelFor(Function(Model) Model.IDGeneroAsegurado)
@Html.DropDownListFor(Function(Model) Model.IDGeneroAsegurado, Nothing, New With {.style = "width:98px; visibility:visible", .class = "letraingreso"})
</td>
</tr>
</table>
</div>
</div>
<br />
<fieldset>
<legend>Observaciones</legend>
@Html.LabelFor(Function(Model) Model.Observaciones)
@Html.TextBoxFor(Function(Model) Model.Observaciones, New With {.class = "letraingreso", .style = "width:90%; text-transform:uppercase"})
</fieldset>
</fieldset>
@<div style="display:none; position:absolute; margin:auto; left:0; right:0; text-align:center" id="inprogress">
<br /><br /><br /><br /><br /><br />
<img id="inprogress_img" src="@Url.Content("~/Images/loading.gif")" alt="Procesando..." />
<br />
Por favor espere mientras su solicitud es procesada...
</div>
@<p>
<input type="submit" value="Guardar" id="cmdGuardar" onclick="return doSubmit()" />
</p>
@<div>
@Html.ActionLink(" ", "ListarCertificadosAPG", "CertificadosLayout", New With {.area = ""}, New With {.class = "imgRegresar", .title = "Regresar"})
</div>
End Using
正如我所说,在 MVC3 中,提交按钮提升控制器:
<HttpPost()> _
Function Create(<Bind(Exclude:="IDCertificado, IDAsegurado")> ByVal parCertificadoAPG As Global.iSAM.Certificados) As ActionResult
todo 结束函数
但是在 MVC4 中没有触发 HttpPost。我在视图代码中的End Using之后放置了下一个代码(就像示例一样) :
@Using Html.BeginForm()
@<input type="submit" value="SSS" />
End Using
当我按下SSS按钮时,它会引发 HttpPost。有人可以帮我解决或理解错误或错误在哪里吗?
问候。