Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7760971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:02:11+00:00 2026-06-01T14:02:11+00:00

I have a little newbie problem that I cannot figure out, I am having

  • 0

I have a little newbie problem that I cannot figure out, I am having a form that generated from a partial view from a asp.net controller, it is then displayed in a jquery dialog.

I have 2 buttons on the dialog (Save / Cancel)

On the save button, I want to serialize the inputs from the form to send it back to the Asp.net mvc actionController, however it doesn’ t seems to work, the actioncontroller does not getting the model object from Jquery Dialog, I am using Jquery Serialize function for the form.

Here is the Script code:

<button id="btnDialog">Account Logon</button>

<div id="Logonform"></div>

<script type="text/javascript">

    $(document).ready(function () {

        $.validator.unobtrusive.parse("#Logonform");

        $("#Logonform").dialog({
            autoOpen: false,
            modal: true,
            title: 'Login',

            buttons: {
                Save: function () {
                    alert($("#Logonform").serializeArray());
                    alert($("#Logonform").attr('UserName'));

                    $.ajax({
                        url: "@Url.Action("LogOn", "Account")",
                        type: "POST",
                        data: $("#Logonform").serialize(),
                        datatype: "JSON",
                        success: function (result) {
                            $("#Logonform").html(result).dialog('open');
                        }
                    });
                },

                Close: function () {
                    $(this).dialog('close');
                }
            }

        });

        $("#btnDialog").click(function () {
            $.ajax({
                url: "@Url.Action("LogOn", "Account")",
                type: "GET",
                success: function (result) {
                    $("#Logonform").html(result).dialog('open');
                }

                });
        });
    })

</script>

The controller:

    public ActionResult LogOn()
    {
        if (Request.IsAjaxRequest())
        {
            return PartialView("_Logon");

        }
        return View();
    }

    [HttpPost]
    public ActionResult LogOn(LogOnModel model)
    {
        if (ModelState.IsValid)
        {
            if (Membership.ValidateUser(model.UserName, model.Password))
            {
                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                return Json( new { result = "ok", user = model.UserName });
            }
            else
            {
                return PartialView("_Logon");
            }
        }

the view:

@model JqueryDialogTest.Models.LogOnModel


<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Models/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@Html.ValidationSummary(true, "Échec de la connexion. Corrigez les erreurs et réessayez.")

@using (Html.BeginForm()) {
    <div>
        <fieldset>
            <div class="editor-label">
                @Html.LabelFor(m => m.UserName)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.UserName)
                @Html.ValidationMessageFor(m => m.UserName)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Password)
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.Password)
                @Html.ValidationMessageFor(m => m.Password)
            </div>

            <div class="editor-label">
                @Html.CheckBoxFor(m => m.RememberMe)
                @Html.LabelFor(m => m.RememberMe)
            </div>

        </fieldset>
    </div>
}

Any comment from you to point out what wrong would be very grateful

Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:02:11+00:00Added an answer on June 1, 2026 at 2:02 pm

    Try changing your Logon action parameter from a LogonModel type to a string and deserializing it yourself in the action method using JavascriptSerializer. If that still does not work use Fiddler to see what (if anything) is being sent over in the POST.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As I'm a newbie to jQuery I'm having a little problem. I have two
ok im a newbie on sessions lets imagine that we have a little login
Here is a little problem that cannot be resolved by me such a Linux
Hi I'm a newbie on grails, im having a little problem now, i created
I'm totally newbie in javascript/jQuery and i have a little problem :) I'm using
Newbie in javascript.. Need a little help. I have a SPAN or IMG that
i need help with a little code that i have below. i'm a newbie
I'm a jQuery newbie, and I have trouble with a little script I created.
i have little problem with boost::asio library. My app receive and process data asynchronously,
I have little snippet for validatin' my form. I need help to position the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.