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 8741929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:24:25+00:00 2026-06-13T11:24:25+00:00

ASP .NET MVC2 page contains order header data (order number, customer, order data etc):

  • 0

ASP .NET MVC2 page contains order header data (order number, customer, order data etc):

<form id='_form' class='form-fields' action='' onsubmit='SaveDocument();return false;'>
<input id='Number' name='Number' />

<select id='PaymentTerm' name='PaymentTerm'>
<option value=''></option><option value='0'>Cash</option>
<option value='10'>10 days</option>
</select>

</form>

and order rows presented in jqgrid.

I’m looking for a way to fill order headcer data from json date from controller like
like jqgrid fills data.
To minimize request maybe it is best to return header data in jqgrid data request.
For this additional parameter documentId is passed to controller.

GetData returns document header as name value pairs in document object.
How to assign those values to form elements in browser in jqgrid loadcomplete or other place ?

public JsonResult GetData(int page, int rows, string filters,
          int documentId )

{
    var query = ...;
    var totalRecords = query.Count();

    var documentHeader = new FormCollection();
    // In production code those values are read from database:
    documentHeader.Add("Number", 123);  // form contains input type='text' name='Number' element
    documentHeader.Add("PaymentTerm", "10"); // form contains select name='PaymentTerm' element
    ...

    return Json(new {
        total = page+1,
        page=page,
        document = documentHeader,
        rows = (from item in query
                select {
                    id = item.Id.ToString(),
                    cell = new[] {
                        item.ProductCode,
                        item.ProductName,
                        item.Quantity,
                        item.Price
                    }
                 }).ToList()
    },
    JsonRequestBehavior.AllowGet);
}
  • 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-13T11:24:26+00:00Added an answer on June 13, 2026 at 11:24 am

    If I understand correct your question you can use beforeProcessing or loadComplete callbacks to fill the form data based on the response from the server. The first data parameter of both callbacks (beforeProcessing or loadComplete) will contains all the data returned from the server. So you have access to document property of data and it has the same format as on the server.

    I am not sure why you use document of the type FormCollection. It seems to me the most native to use anonymous type of data:

    return Json(new {
        total = page + 1,
        page = page,
        document = new {
            number = 123,
            paymentTerm = 10
        },
        rows = (...)
    },
    JsonRequestBehavior.AllowGet);
    

    but the exact type of document is probably not so important.

    Inside of beforeProcessing or loadComplete you can just use the corresponding properties of data.document in the same format. For example

    beforeProcessing: function (data) {
        var hearderData = data.document;
        if (hearderData) {
            if (hearderData.number) {
                $("#Number").val(hearderData.number);
            }
            if (hearderData.paymentTerm) {
                $("#PaymentTerm").val(hearderData.paymentTerm);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jqGrid is powered by remote json data in ASP .NET MVC2 application. On page
ASP .NET MVC2 application. Site.Master file contains number of ul list link names, url
I'm using ASP.NET MVC2 and I have the following object structure: public class IDealer
How do I create a menu in a ASP.NET MVC2 Master Page, dynamically based
I have a ASP.NET MVC2 application with a master page. The master page renders
Can I Inherit a view in asp.net mvc2 from normal asp.net master page
I am currently working on a mobile web page in asp.Net MVC2 that allows
ASP .NET MVC2 application controller performs some action and redirects to grid page after
I am playing around with Asp.net MVC2 and trying to write a page which
Page contains single form with input elements and jqgrid data. jqGrid data is retrieved

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.