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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:02:13+00:00 2026-05-18T04:02:13+00:00

I am using ASP.MVC and jqgrid 3.7.2. The data loads OK into the grid

  • 0

I am using ASP.MVC and jqgrid 3.7.2. The data loads OK into the grid and subgrid. Updating the master part of the table works great. I can update or remove a row from the subgrid since one of the fields in the subgrid is the primary key of the parent row. But when trying to add a row when the row is posted back to the server I am having trouble getting the parent row’s Id. All the other subgrid values are posted as expected. I thought about trying to get the “selected” row of the parent, but the parent row is not selected, so I am not sure how to go about getting the parent rows Id (primary key) in master table thus will be a foreign key in the detail table. When there is any data is the subgrid, I can also get the parent’s id since all my subgrid’s rows have that as a hidden field. I noticed that during the post an Id field is part of the postback, but the value is null. Any ideas? I am using editing from the navigation bar.

  • 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-05-18T04:02:14+00:00Added an answer on May 18, 2026 at 4:02 am
    subGridRowExpanded: function (subgrid_id, row_id) {
        var currentRow = $('#UtilitiesGrid').jqGrid('getRowData', row_id);
        var utilityPrimaryKey = currentRow.UtilityId;
    ...
    
    colNames: ['parentid','subid',...], //insert parentid column, hidden
    colModel: [{name:"parentid", index:"parentid", hidden:true, editable:true, 
            editoptions: {
                disabled:true, //dissabled in case colModel->hidden=false
                value:utilityPrimaryKey , //Value for parentid in the add form
            },
                {name:"subid",index:"subid",key:true,hidden:true}
    ...
    
    $("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{
                        add:true, 
                        del:true, 
                        refresh:true,
                        refreshstate:"current",
                        search:false,
                    },
                    {},//edit options
                                    //add options
                    {recreateForm:true //since clearAfterAdd is trueby default, recreate the form so we re-establish value for parent id
                    });  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i m using a jqgrid on asp.net mvc... i have a specific requirement....The data
If you are using ASP.NET MVC how are you doing grid display? Rolled your
This is NOT a Master/Detail question. I am using ASP.Net MVC and trying to
I'm having a problem with JQGrid using ASP.NET MVC. I'm trying to follow this
I'm currently using jqGrid and ASP.Net MVC. With my current project, my goal is
I am following Phil Haack's example on using jQuery Grid with ASP.NET MVC .
I am following Phil Haacks tutorial on using JQGrid with ASP.Net MVC. My application
i have an asp.net-mvc web page and i am using jqgrid on the front
i used this link to build a basic jqgrid: http://haacked.com/archive/2009/04/14/using-jquery-grid-with-asp.net-mvc.aspx this my code: <script
I am using ASP MVC with JQuery and posting json data to my controller.

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.