disable "INS" key

In the GridEditSetting I set the value of AllowAdding = "false" but despite this if I press the "INS" key the grid adds a new row. Unlike the other options, this one does not give the expected result.
thanks

1 Reply 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team November 13, 2020 05:19 AM UTC

Hi Salvatore,  
 
Thanks for contacting Syncfusion support.  
 
Query: “I set the value of AllowAdding = "false" but despite this if I press the "INS" key the grid adds a new row 
 
We have analyzed the reported query and we are able to reproduce the behavior at our end also. We suggest you to overcome the issue by prevent the default action in OnActionBegin event of Grid using Args.Cancel property.  
 
Refer the below code example. 
 
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add""Edit""Delete""Cancel""Update" })" Height="315"> 
    <GridEditSettings AllowAdding="false" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Normal"></GridEditSettings> 
    <GridEvents OnActionBegin="OnActionBegin" TValue="Order"></GridEvents> 
</SfGrid> 
  
@code{ 
    SfGrid<Order> Grid { getset; } 
    public List<Order> Orders { getset; } 
    public void OnActionBegin(ActionEventArgs<Order> Args)   {       if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Add && !Grid.EditSettings.AllowAdding)       {           Args.Cancel = true;       }   }
 
 
Kindly download the sample from below  
 
 
Refer the below documentation for your reference 
 
 
Please get back to us if you have further queries.  
 
Regards,
Vignesh Natarajan
 


Marked as answer
Loader.
Up arrow icon