Second line is not required, it doesn't seem to do anything as Name == rowDataMain.Name ( rowDataMain is a reference to row data)
$('#templateDataGrid').pqGrid("updateRow", { rowIndx: parseInt(masterIndexNr), row: { 'Name': rowDataMain.Name } });
Anyway I understand updateRow would make it easier, still when you click on the apply button you can loop through all the detail grids, check isDirty() on each one of them, collect their corresponding rowDataMain into an array and post it to the server.
I hope it helps.