ASP.NET Razor:表单(在对话框中)未提交

时间:2012-04-20 08:58:17

标签: asp.net asp.net-mvc-3 razor

我正在尝试获取(AJAX(现在没有AJAX))表单以在jquery对话框中提交。但由于某些原因,标签永远不会被渲染。

包含的脚本:

   <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

    <link href="@Url.Content("~/Content/jquery-ui-1.8.19.custom.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.19.custom.min.js")" type="text/javascript"></script
    >
<script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/MicrosoftMVCAjax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/ckeditor/ckeditor.js")" type="text/javascript"></script>
<script src="@Url.Content("~/ckeditor/adapters/jquery.js")" type="text/javascript"></script>
 <script src="@Url.Content("~/Scripts/jquery.inputfocus-0.9.min.js")" type="text/javascript"></script>
 <link href="@Url.Content("~/Content/progress.css")" rel="stylesheet" type="text/css" />
 <script src="@Url.Content("~/Scripts/multiform.js")" type="text/javascript"></script> 



 <div id="hidden" style="display:none;">
    <div id="coinDialogue" title="New Coin">
        @using(Html.BeginForm("CreateCoin", "Home"))
        {
             @Html.ValidationSummary(true)
            <div style="display: inline;">
                <label for="FaceValue">
                    Coin value</label>
                <input type="text" name="FaceValue" id="FaceValue" value="" style="width: 35px;" />
                <select id="currency_type" name="currency_type">
                    <option value="USD" selected="selected">USD</option>
                    <option value="EUR">EUR</option>
                </select>
            </div>
            <br />
            <label for="ReusePeriod">
                Usage:</label>
            <select id="ReusePeriod" name="ReusePeriod">
                <!-- Loop with for and values from Model (gotten from Paycento API) -->
                <option value="o" selected="selected">Once</option>
                <option value="w" >Weekly</option>
            </select>
            <br />
            <label for="ValidFrom">
                Validate from</label>
            <br />
            <input type="text" id="ValidFrom" name="ValidFrom" value="" />
            <br />
            <label for="ValidUntil">
                Validate To</label>
            <input type="text" id="ValidUntil" name="ValidUntil" value="" />
            <br />
            <input type="submit" value="Create new coin" />
        }
    </div>
    <script type="text/javascript">
        $('#coinDiaLink').click(function () {
            $('#coinDialogue').dialog({
                buttons: {
                    Cancel: function () {
                        $(this).dialog('close');
                    },
                    Create: function () { 
                        $('#createCoinForm').trigger('submit');
                    }
                }
            });
        });
    </script>
    </div>

1 个答案:

答案 0 :(得分:0)

请你用Html.BeginForm&amp;替换Ajax.Beginform看看它是否发布了整个页面,如果确实是,那么问题之一可能是 - Ajax.Beginforms需要一些脚本文件包含在视图或masterview中,看看是否缺少这些文件

jquery.unobtrusive-ajax.min.js
MicrosoftAjax.js
MicrosoftMvcAjax.js