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

  • Home
  • SEARCH
  • 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 9177447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:19:45+00:00 2026-06-17T17:19:45+00:00

This question is continuation of the following question Add JSON data to the view

  • 0

This question is continuation of the following question Add JSON data to the view that unfortunately ended up unresolved yet.

In my main view which has a form with 2 controls and placeholder for flexigrid I added the following at the bottom

<div id="add-edit-dialog" style="display: none" title="Add / Edit Client"> 
    @Html.Partial("_ClientForm", Model)
</div>

The flexigrid pluglin instantiates in run-time and adds 3 buttons: Add, Edit, Delete.
For Edit button I need to get the current row information from the server and then display it in the Form. For Add button I do not need to go to the server (I think).

This is my current code for the Edit button:

function edit(com, grid) {
    $('.trSelected', grid).each(function () {

        var id = $(this).attr('id');
        id = id.substring(id.lastIndexOf('row') + 3);
        currentId = id;
        $('#fntype').val('Edit');
        var ClientName;
        ClientName =$('.trSelected td:eq(2)').text();
        var url = '/Client/Edit/' + id ;

        $.getJSON(url, function (html) {
            // setFormControls(data.Id, data.Role, data.Location, data.JobType,
                // data.Description);
            // alert(data);
            $($dlg).html(html);
        });
        //location.replace(url);
        RunModalDialog("Edit Client: " + ClientName);
    });

So, it is going to Edit controller action and returns that same partial view _ClientForm with correct information passed as a model. If I look at the response result returned in FireBug I can see that the returned HTML is correct and all the textboxes have correct information in their values.

However, the dialog that opens looks exactly the same as the dialog for the Add button – in other words, all form controls come blank. I can not figure out what is wrong and why it is not working the way I want it.

This is what I have for the RunModalDialog:

var validator = $("#add-edit-form").validate();

var $dlg = $("#add-edit-dialog").dialog({
    autoOpen: false,
    show: "blind",
    closeOnEscape: true,
    resizable: true,
    width: 1200,
    height: 750,
    minHeight: 600,
    minWidth: 950,
    buttons: {
        "Save": function () {

            if ($("#add-edit-form").valid()) {
                // jobPost.setVals(txtId.val(), txtRole.val(), 
                    // txtLocation.val(), txtJobType.val(), 
                    // txtDescription.val());

                $.ajax({
                    type: 'POST',
                    //data: JSON.stringify(clientInformation),
                    url: '/Client/Save',
                    dataType: 'json',
                    contentType: 'application/json',
                    success: function (result) {
                        // insert new list into grid
                        $('#flexClients').flexAddData(result);
                    }
                });
                $(this).dialog('close');
            } else return false;
        },
        Cancel: function () {
            $(this).dialog("close");
            clearForm();
            if (validator)
                validator.resetForm();
        }
    },
    close: function () {
        clearForm(); 
    },
    open: function () {
        //$("#add-edit-dialog").parent().appendTo($("#add-edit-form"));
    }
});

function RunModalDialog(title, url) {    
    if (title) {
        $dlg.dialog("option", {"title": title });
    }
    if (url) {        
        $dlg.load(url).dialog("option", { "title": title }).dialog("open");

        //$dlg.load(url, function () {
        //    var validator = $("#sform").validate();
        //    if (validator)
        //         validator.resetForm();
        //    $dlg.dialog("option", { "title": title }).dialog("open");
        //});
    } else {
        $dlg.dialog("open");
    }
}

The code with the load (and commented code) was another attempt to solve this problem. That sort of worked (the form displayed with the info), but the main Client view was also reloaded so I was seeing double grid.

Do you see what should I change in my code to get this thing working?

Thanks a lot in advance.

  • 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-17T17:19:46+00:00Added an answer on June 17, 2026 at 5:19 pm

    With Jazzen Chen from MS help we solved this problem. All I needed to do to display the data correctly was to change getJSON to just get jquery function. Now my form comes with data populated correctly and the next challenge will be to save the data.

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

Sidebar

Related Questions

This is in continuation to the question which was raised here How to add
This question comes a bit as continuation of the following topic (you don't need
In continuation of this question I ask the following question. I've managed to read
A continuation from this question I need a SQL statement that returns the number
This is a continuation of my previous question here . In the following example:
This is a continuation of another question I have. Consider the following code: char
This question is a continuation of Can XPath return only nodes that have a
This question is a continuation of my previous question here zend models architecture (big
This question is in continuation to my previous question . I am trying to
This is a continuation of this question from yesterday . Here are my three

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.