views:

1677

answers:

1

Hi folks,

I'm trying to implement a JqGrid with a subgrid as so...

     jQuery(document).ready(function() {
                jQuery("#list").jqGrid({
                    url: '/OrganizationalUnit/FindAll/',
                    datatype: 'json',
                    mtype: 'GET',
                    colNames: ['Name', 'Actions'],
                    colModel: [ 
                      { name: 'Name', index: 'Name', width: 500, align: 'left' },                  
                      { name:'act', index:'act', width:250,sortable:false}

                      ],                    

                        subGrid : true, 
                        subGridUrl: '/OrganizationalUnit/Organizations/', 
                        subGridModel: 
                        [
                          { name: 'Name', index: 'Name', width: 300, align: 'left' },
                          { name: 'OrganizationID', index: 'OrganizationID', width: 300, align: 'left' }                   

                    ] 
                          ...


So the way JqGrid works is that when the controller method for OrganizationalUnitController.Organizations gets called, a query string of "?id=4" gets appended to the URL. M problem is that the "4" is just an arbitrary row number that JqGrid has created for the grid and doesn't provide me with an identifier for the OrganizationalUnit the I trying to retreive a subgrid for. So what I'm wondering is it there is any way that I can assign the 'name' value to the id argument?

Has anyone figured this out before?

+1  A: 

Ok...I have figured it out.

If I add the params: ['name'] arguement to the subGridModel definition then I can get the value of the OrganizationalUnit name through the HttpContext.Request.Params collection.

matt_dev
could you please write the solution here ... it would save some time thanks
jalchr