|
<SfGrid DataSource="@OrdersService" Toolbar="@(new List<string>() { "Add" })"
AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="false">
. . .
<GridColumns>
<GridColumn Field="@nameof(Orders.OrderId)" HeaderText="ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="140"></GridColumn>
. . .
</GridColumns>
</SfGrid> |
Hi Preveen,
We have validated your query and we suggest you to ensure to enable a IsPrimaryKey column in Grid. Could you please ensure whether did you defined IsPrimaryKey column in your Grid. Find the below code snippets for your reference.
<SfGrid DataSource="@OrdersService" Toolbar="@(new List<string>() { "Add" })"AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="false">. . .<GridColumns><GridColumn Field="@nameof(Orders.OrderId)" HeaderText="ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="140"></GridColumn>. . .</GridColumns></SfGrid>
Here, we have reattached the sample for your reference.
Note: to run the sample, change the connection string in the NorthwindContext.cs file with Database (MDF) location inside AppData
If you are still facing the problem could you please share the below details. It will be helpful to validate and provide a better solution.
- Full Grid code snippets.
- Syncfusion NuGet version details.
Regards,Rahul