79674410

Date: 2025-06-21 12:04:46
Score: 0.5
Natty:
Report link

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.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: İlahi Nasirov