I want to use link in row's JqGrid. This link get id from Row's click and redirect to another page and show another JqGrid. I use this code:
<script type="text/javascript">
var searchOptions = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'bw', 'bn', 'in', 'ni', 'ew', 'en', 'cn', 'nc'];
$(document).ready(function () {
$('#list').jqGrid({
caption: "ObisData",
//url from wich data should be requested
url: '@Url.Action("GetObisData", "DataGrid")',
//EditData
editurl: '@Url.Action("EditData", "DataGrid")',
//type of data
datatype: 'json',
jsonReader: {
root: "Rows",
page: "Page",
total: "Total",
records: "Records",
repeatitems: true,
id: "ObisDataID",
cell: "RowCells",
subgrid: { root: "Rows", repeatitems: true, cell: "RowCells" }
},
//url access method type
mtype: 'POST',
//columns names
colNames: ['', 'power', 'water', 'serial M', 'serial C', 'Date', ''],
//columns model
colModel: [
{
name: 'ObisDataID', index: 'ObisDataID', align: 'right', width: 100,
editable: false, hidden: true, key: true
},
{
name: 'MeterPowerSharingNo', index: 'MeterPowerSharingNo', align: 'center', width: 100,
editable: false, hidden: false
},
{
name: 'MeterWaterSharingNo', index: 'MeterWaterSharingNo', align: 'center', width: 100,
editable: false, hidden: false
}
,
{
name: 'ModemSerial', index: 'ModemSerial', align: 'center', width: 100,
editable: false, hidden: false
},
{
name: 'MeterSerial', index: 'MeterSerial', align: 'center', width: 100,
editable: false, hidden: false
}
,
{
name: 'MessageDate', index: 'MessageDate', align: 'center', width: 170,
editable: false, hidden: false
},
{
name: 'EditAction', index: 'EditAction', align: 'center', width: 170,
formatter: function (cellvalue, options, rowObject) {
return "<a href='/DataGrid/GetAllObisData'><u>Show Detail</u></a>";
}
}
],
//pager for grid
pager: $('#pager'),
//number of rows per page
rowNum: 10,
rowList: [10, 20, 50, 100],
//initial sorting column
sortname: 'ObisDataID',
//initial sorting direction
sortorder: 'desc',
//we want to display total records count
viewrecords: true,
altRows: true,
shrinkToFit: false,
width: '900',
height: 'auto',
hidegrid: false,
direction: "rtl",
gridview: true,
rownumbers: true,
footerrow: true,
//userDataOnFooter: true,
loadComplete: function () {
//change alternate rows color
$("tr.jqgrow:odd").css("background", "#E0E0E0");
},
loadError: function (xhr, st, err) {
jQuery("#rsperror").html("Type: " + st + "; Response: " + xhr.status + " " + xhr.statusText);
},
subGrid: true,
subGridModel: [{
name: ['Data', 'translate'],
width: [150, 150],
align: ['center', 'center']
}],
subGridOptions: {
reloadOnExpand: false //load only once
},
subGridUrl: '@Url.Action("GetSubGridObisData", "DataGrid")'
});
});
but error when click 'show detail'.
The parameters dictionary contains a null entry for parameter 'page' of >non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetAllObisData(System.String, System.String, Int32, Int32, Boolean, System.String, System.String, System.String, System.String)' in 'MeterControl.Controllers.Grids.DataGridController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter"