Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
450
igGrid: Unable to pass any data from view to controller in ajax call
posted

Hi Team,

I am using an iggrid and I am unable to pass any data from view to the controller in ajax call . Below is my code

Javascript code 

$("#csagrid").igGrid({
columns: [

{ headerText: "Manager", key: "EMPLOYEE_NAME", dataType: "string" },
{ headerText: "CSA", key: "CSA_NB", dataType: "string" },
{ headerText: "Entry Date", key: "ENTRY_DATE", dataType: "date" },
{ headerText: "Project Name", key: "PROJECT_NAME", dataType: "string" }

],
defaultColumnWidth: "200px",

width: "100%",
showHeaders: true,
fixedHeaders: false,
type: "POST",
caption: "Report",
dataSourceType: "json",
dataSource: "/Reports/CSAReportData/",
data: { year: "0017" }
});

Controller code

public JsonResult CSAReportData(string year)
{

return jsonResult;
}

Although I am passing "0017" in year parameter but unable to get it in the controller code . I am getting null in controller .

Parents
No Data
Reply
  • 16310
    Offline posted

    Create a class containing year: string property and expect object of this type in the controller:

    public class DateYear {

    public year: string {get; set;}

    }

    public JsonResult CSAReportData(DateYear date)
    {

    return jsonResult;
    }

Children