Asp.net mvc net MVC Razor+;JQuery UI delaog(登录弹出窗口)

Asp.net mvc net MVC Razor+;JQuery UI delaog(登录弹出窗口),asp.net-mvc,razor,Asp.net Mvc,Razor,这是我的用例。当用户单击“登录”按钮时,会弹出一个jQueryUI对话框并询问用户名/密码。当我点击提交,我的家应该是登录 为了实现这一点,我在对话框中创建了一个表单,并使用了提交按钮。但我从未联系过控制器(AccountController.cs) 相反,它总是调用(AccountController.cs) jquery对话框中的我的表单如下所示(Index.cshtml) 我确信我在某个地方犯了一些配置错误,但无法确定在哪里。我假设“Submit”会调用帐户控制器(但我想知道我在哪里配置它

这是我的用例。当用户单击“登录”按钮时,会弹出一个jQueryUI对话框并询问用户名/密码。当我点击提交,我的家应该是登录

为了实现这一点,我在对话框中创建了一个表单,并使用了提交按钮。但我从未联系过控制器(AccountController.cs)

相反,它总是调用(AccountController.cs)

jquery对话框中的我的表单如下所示(Index.cshtml)


我确信我在某个地方犯了一些配置错误,但无法确定在哪里。我假设“Submit”会调用帐户控制器(但我想知道我在哪里配置它)。我还尝试了@Html.ActionLink。但不确定将模型对象传递到何处。

您可以在
BeginForm

@using (Html.BeginForm("Login", "Account", routeValues))
还有js

$("#dialog-form").dialog({
    autoOpen: false,
    height: 220,
    width: 350,
    modal: true,
    buttons: {
        "Submit": function () {
            $("#LogOnForm").submit(); <-- this is the trick
        },
        Cancel: function () {
            $(this).dialog("close");
        }
    }
});
$(“#对话框窗体”).dialog({
自动打开:错误,
身高:220,
宽度:350,
莫代尔:是的,
按钮:{
“提交”:函数(){

$(“#LogOnForm”).submit();检查浏览器的网络监视器。确保当您点击submit时,它会记录
POST Account/Login
。状态代码和标题将为您提供更多调试信息。
@model MyProject.Models.LoginModel
.
.
.
<section id="loginForm">
        @using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)

            <fieldset>
                @Html.LabelFor(m => m.UserName)
                @Html.TextBoxFor(m => m.UserName, new { @Value = "jane@smith.com", @class = "text ui-widget-content ui-corner-all" })
                <input type="password" name="password" id="password" value="xxxxxxx" class="text ui-widget-content ui-corner-all"-->
                @Html.LabelFor(m => m.Password)
                @Html.PasswordFor(m => m.Password, new { @Value = "xxxxxxx", @class = "text ui-widget-content ui-corner-all" })
                <input type="submit" value="Log in" />
                <p>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</p>
            </fieldset>
    }
</section>
dialog = $("#dialog-form").dialog({
            autoOpen: false,
            height: 220,
            width: 350,
            modal: true,
            close: function () {
                form[0].reset();
                allFields.removeClass("ui-state-error");
            }
        });
@using (Html.BeginForm("Login", "Account", routeValues))
$("#dialog-form").dialog({
    autoOpen: false,
    height: 220,
    width: 350,
    modal: true,
    buttons: {
        "Submit": function () {
            $("#LogOnForm").submit(); <-- this is the trick
        },
        Cancel: function () {
            $(this).dialog("close");
        }
    }
});