Hi Avinash,
Greetings from Syncfusion support.
By analyzing your code, we found that you did not send verification token in the Grid headers. This may cause the reported behavior.
In Razor project, the POST request is used for calling the URL method in the index.cshtml.cs page, so we need to configure ‘XSRF-TOKEN’ in the program.cs page like given below,
|
[program.cs]
builder.Services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");
|
Then, add the verification token to the Grid data source’s header property in its load event as explained in the following code snippet,
|
[index.cshtml]
@Html.AntiForgeryToken()
<ejs-grid id="Grid" allowPaging="true" load="onLoad" toolbar="@( new List<object>() {"Edit","Update","Cancel"})">
---
</ejs-grid>
<script>
function onLoad() {
this.dataSource.dataSource.headers = [{ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val() }];
}
</script>
|
Refer to the below link to know more about anti-forgery-tokens.
Please get back to us if you need any assistance.
Regards,
Rajapandiyan S