Get out of edit mode after you're finished with editing
When editing data in the grid, how do I exit out of edit mode?
Here's my code:
private void OnBeginHandler(ActionEventArgs<User> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
if (Args.Action == "Add")
{
var newUser = Args.Data;
// Call procedure to insert into DB
_userData.AddUsers(newUser);
}
else if (Args.Action == "Edit")
{
var editUser = Args.Data;
_userData.EditUser(editUser.Id, editUser); // After this line is run, the grid is still in edit mode...
}
}
}
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
RN
Rahul Narayanasamy
Syncfusion Team
October 26, 2020 02:31 PM UTC
Hi Preveen,
Greetings from Syncfusion.
Query: Get out of edit mode after you're finished with editing
We have validated your query with provided information and we would like to inform you that the edit mode was ended once we perform update operation. If we explicitly cancel the default operation, then only the edit operation was not ended. Here, we have prepared a sample for your reference.
Please let us know if you have any concerns.
Regards,
Rahul
Marked as answer
PR
Preveen
October 30, 2020 12:27 AM UTC
Thank you,

But unfortunately I can't run your example.
I'm using Dapper to perform CRUD in SQL Server database.
I can enter edit mode (inline), but when I press the Enter key, the UI remains (the cells remain in textbox style)
RN
Rahul Narayanasamy
Syncfusion Team
October 30, 2020 02:43 PM UTC
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
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
Thank you,
This was what I was looking for. I just commented out the column ID which was keeping me from exiting the edit mode.
I uncommented the code, and just hid the column which works fine for me.
Thanks again, Rahul!
RN
Rahul Narayanasamy
Syncfusion Team
November 2, 2020 07:11 AM UTC
Hi Preveen,
Thanks for the update.
We are happy to hear that the provided solution was helpful to resolve the problem.
Please get back to us if you need further assistance.
Regards,
Rahul
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
- Marked answer
-
PR Preveen
- Oct 25, 2020 08:35 PM UTC
- Nov 2, 2020 07:11 AM UTC