0

私は MVC3 (VB.NET) で作成されたシステムを使用しており、正常に動作しています。このシステムを MVC4 (ベータ) にアップグレードしようとしていますが、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 が発生します。間違いやエラーがどこにあるかを解決または理解するのを手伝ってくれる人はいますか?

よろしく。

4

1 に答える 1

1

いくつかのテストの後、送信が発生しない理由を見つけました。私の MainLayout では、次のように宣言しました。

<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js")"></script>

この行にコメントして、作品を提出する必要がありました。ただし、この行で送信が機能しない理由はわかりません。

MVC4 RC をインストールして、次の 3 行をコメントしました。

<link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" />
<link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/themes/base/css")" rel="stylesheet" type="text/css" />
<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js")"></script>

これらの行が何をするかを知るために、より深い MVC4 を確認する必要があります。皆さんよろしく。

于 2012-06-09T17:51:19.720 に答える