I have a Jquery grid which i am binding using an ajax call to the controller. The controller method is being hit during the ajax call, but the parameter values as passing as null tothe controller method.
The parametre values are bound correctly in the ajax property 'data:'
Here is my JavaScript Code:
function BindGridData()
{
var BUids=$("#ddlBU").val().join(",");
var Zoneids=$("#ddlZone").val().join(",");
var Regionsids=$("#ddlRegion").val().join(",");
var Territoryids=$("#ddlTerritory").val().join(",");
$("#tblJQGrid").jqGrid(
{url: "@Url.Action("GetGeographyBreakUpData", "GeoMap")",
datatype: "json",
data: "{BUIds :'" + BUids + "',ZoneIds:'"+Zoneids+"',RegionIds:'"+Regionsids+"',TerritoryIds:'"+Territoryids+"'}",
mtype: 'GET',
colNames: ['Id','GeoGraphy', 'Completed', 'InProgress'],
colModel: [
{ name: 'Id', index: 'Id', width: 20, stype: 'text',hidden:true },
{ name: 'Geography', index: 'Geography', width: 150 },
{ name: 'Completed', index: 'Completed', width: 150 },
{ name: 'InProgress', index: 'InProgress', width: 150 },
],rowNum: 10,
sortname: 'Id',
viewrecords: true,
sortorder: "desc",
caption: "Geographical Survey Status",
scrollOffset: 0});
var res=$('#ddlResponseType').val();
res=res.join(',');
if(res=='1')
{
$("#tblJQGrid").hideCol("Completed");
}
else if(res == '2')
{
$("#tblJQGrid").hideCol("InProgress");
}
else
{
$("#tblJQGrid").showCol("InProgress");
$("#tblJQGrid").showCol("Completed");
}
}
Here is my controller method
public string GetGeographyBreakUpData(string BUIds, string ZoneIds, string RegionIds, string TerritoryIds, string MarketIds, string FOIds, string ResponseTypeIds, string FromDate, string ToDate, string GridBreakUpLevel)
{
}
Can someone tell me where my code is at fault?
UPDATE
I have tried to send the values using the Params
array,
even then the Params
array is passed as null
Here is the updated code
var BUids=$("#ddlBU").val();
var Zoneids=$("#ddlZone").val();
var Regionsids=$("#ddlRegion").val();
var Territoryids=$("#ddlTerritory").val();
Params = new Array();
Params.push(BUids);
Params.push(Zoneids);
Params.push(Regionsids);
Params.push(Territoryids);
Params = Params.join("|");
$("#tblJQGrid").jqGrid(
{url: "@Url.Action("GetGeographyBreakUpData", "GeoMap")",
datatype: "json",
data: { "Parameters": Params },
mtype: 'GET',
colNames: ['Id','GeoGraphy', 'Completed', 'InProgress'],
colModel: [
{ name: 'Id', index: 'Id', width: 20, stype: 'text',hidden:true },
{ name: 'Geography', index: 'Geography', width: 150 },
{ name: 'Completed', index: 'Completed', width: 150 },
{ name: 'InProgress', index: 'InProgress', width: 150 },
],rowNum: 10,
sortname: 'Id',
viewrecords: true,
sortorder: "desc",
caption: "Geographical Survey Status",
scrollOffset: 0});
Controller
public string GetGeographyBreakUpData(string Parameters)
{
}
Even this doesn't work.