Hi Seil,
Greetings from Syncfusion support.
We suggest you to set property binding for the Mode property of GridEditSettings to achieve this requirement. In the below code, we have modified the Mode property value dynamically based on the RequestType in the OnActionBegin handler. Please refer and use as like the below code,
<SfGrid @ref="Grid" DataSource="@Orders" ...>
<GridEvents OnActionBegin="OnActionBegin" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditModeSelection" ></GridEditSettings>
...
</SfGrid>
@code{
SfGrid<Order> Grid;
EditMode EditModeSelection { get; set; }
public List<Order> Orders { get; set; }
public void OnActionBegin(ActionEventArgs<Order> args)
{
if (args.RequestType.ToString() == "Add")
{
EditModeSelection = EditMode.Dialog;
}
if (args.RequestType.ToString() == "BeginEdit")
{
EditModeSelection = EditMode.Normal;
}
}
...
}
|
We have also prepared a sample based on this scenario. Please download the sample from the link below,
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran