Hi Tümer,
Greetings from Syncfusion support.
Query: I want to send parameter for getting grid data. But controller function parameter comes null everytime. How can i do that ?.
Based on your query we could see that you need send an additional parameter to the server by your ajax post. From the shared code we found that the data passing is incorrect from your ajax post.
In your code example, You're telling your Action (GetClientDeviceDocuments) to expect a variable clientId with string type. yet you're not sending that. Instead of you sending object value (data: JSON.stringify({ clientId })) to the controller.
To achieve your requirement, you need to change the data property of your AJAX request like below.
[index.chstml]
var clientId = "10248VINET";
let ajax = new ej.base.Ajax({
url: '/Home/GetClientDeviceDocuments',
data: JSON.stringify(clientId), // pass the string value
type: 'POST',
contentType: 'application/json'
});
ajax.send();
ajax.onSuccess = function (data) {
grid.dataSource = JSON.parse(data);
};
[HomeControllers.cs]
public IActionResult GetClientDeviceDocuments([FromBody] string clientId) // use the correct data type to deserialize the data
{
return Json(BigData.GetAllRecords());
}
|
Screenshot:
Find the below stackoverflow link for your reference.
Please get back to us if you need further assistance with this.
Regards,
Rajapandiyan S