How to delete selected rows

Hi,

  I have lookup page to show records, and set selection to multiple,  I am able to get the selected rows by calling GetSelectedRecords, but I am having a difficulty on how to delete the selected records to show user that it's already been added.   I tried grid.DeleteRecord("TRANSNO",item) since I set TRANSNO column to be primary, but nothing happens, here is the actual code during select: 

 Btw, I am using blazor WASM.
 
     Here is my razor:

   <SfGrid @ref="grid"
                            AllowPaging="true"
                            Query="@query"
                            TValue="EMRAIRPRO.Shared.LabTransMasterModelList">
                        <GridPageSettings PageSize="5" />
                        <GridEditSettings AllowDeleting="true" />
                        <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></GridSelectionSettings>
                        <SfDataManager Url="labs/getpatientlabs" Adaptor="Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
                        <GridColumns>
                            <GridColumn Field="TRANSNO" HeaderText="Lab No" AllowFiltering="false" IsPrimaryKey="true" Width="120"></GridColumn>
                            <GridColumn Field="TRANSDATE" HeaderText="Date" AllowFiltering="false" Type="ColumnType.Date" Format="d" Width="150"></GridColumn>
                            <GridColumn Field="LABNAME" HeaderText="Lab Name" AllowFiltering="false" Width="150"></GridColumn>
                        </GridColumns>
                    </SfGrid>

And my code:

      public async Task<IEnumerable<EMRAIRPRO.Shared.LabTransMasterModelList>> GetSelection()
        {
            var list = await grid.GetSelectedRecords();
            foreach(var item in list)
            {
                await grid.DeleteRecord("TRANSNO",item);
                //await grid.DeleteRecord(null,item);  //also tried this
            }
            
            return list;

        }

But nothing seems to work, please show me how to do it correctly.

Thanks.

3 Replies 1 reply marked as answer

JP Jeevakanth Palaniappan Syncfusion Team March 8, 2021 12:52 PM UTC

Hi Martin, 

Greetings from Syncfusion support. 

When delete multiple records in Grid, batch request will be send to along with selected records but unfortunately the ASP.NET Core Web API with batch is not yet supported by ASP.NET Core v3+. Hence it is not feasible from us to support multi-delete with Web API, until ASP.NET Core provide the support for the proper batch handler.   
 
Please find the general GitHub link below.  


Please get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 


Marked as answer

MS Martin Sato replied to Jeevakanth Palaniappan March 8, 2021 04:03 PM UTC

Hi Martin, 

Greetings from Syncfusion support. 

When delete multiple records in Grid, batch request will be send to along with selected records but unfortunately the ASP.NET Core Web API with batch is not yet supported by ASP.NET Core v3+. Hence it is not feasible from us to support multi-delete with Web API, until ASP.NET Core provide the support for the proper batch handler.   
 
Please find the general GitHub link below.  


Please get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 


Okay Thank you.


JP Jeevakanth Palaniappan Syncfusion Team March 9, 2021 05:29 AM UTC

Hi Martin, 

Thanks for the update. Please get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon