I wrote the following JavaScript function to generate a dynamic JSON object:
I sent data as json at LoadParams
.LoadParams(new { json = new JS("cl_getSearchModelAsJson") })
function cl_getSearchModelAsJson() {
console.log("cl_getSearchModelAsJson started");
let employeeBox = $("#_Employee").dxSelectBox("instance");
let dateBox = $("#_DocDate").dxDateBox("instance");
let empId = employeeBox ? employeeBox.option("value") : null;
let docDate = dateBox ? dateBox.option("value") : null;
let jsonObject = {
EmployeeId: empId ,
DocumentDate: docDate
};
return JSON.stringify(jsonObject);
}
Then in the controller, you can manually deserialize it into a C# model.