How to update the Current Data Grid Row in Radzen?

Could you let me know which property in RadzenDataGrid shows the current row that we are updating? I am doing an Insert row in RadzenDataGrid and I want to manually update a column based on a result from another column.

If we have a property that targets the current row, I can manually update in the code for that column.
Currently I have @ref="grid" in RadzenDataGrid.

I can use grid.Value to get to the list of items in the grid. But I want to get to the specific index or specific item in the list that is being inserted.

Is there a way we can achieve this?

There is no such property, you can use RowUpdate event similar to this demo:

But RowUpdate will only be triggered for updating a row.

My issue was, while creating a new row and inserting data, say if we have two columns Column A and Column B, when the user enters an Id in Column A, it has to go to the DB and fetch the corresponding name for the id and populate in Column B. So populating Column B should happen before the user clicks on the tick mark to insert that row, as the user has to see what is the name corresponding to the id that will be stored.

Is there a way we can populate column B once we retrieve the data from DB? I believe an index of the current row being populated to be inserted or any parameter to reference the existing row would suffice.

Check your post.

Since you insert the row (the DataGrid grid doesn’t have any built-in UI for that) you can assign whatever you need in any of properties of the new item. I suggest you once again to check the demo I’ve posted.

I see the demo. But that still doesn't give the solution to my issue. Can we manually add values to a specific row in radzen data grid from the code and not from the razor page? I can use the @ref property to get the data of all the rows in the grid. I can also see the property is populating values while I am entering new data . But I am looking for something like a current row property(that points to the current row being inserted/updated) that I can directly update before RowCreate event.


Looks like the property I need to set in code is the itemToInsert from my item property
RadzenDataGrid < Items > item;

But that property does not seem to be exposed to be accessible in the code. Is there a way I can access the itemToInsert from the code like:

item.itemToInsert.Test = "value";

itemToInsert is what is passed as argument of InsertRow() method. Once again, check the demo I’ve posted. You can even get the entire project to debug it in order to know what and when is executed.