grid copy specific row/column

 Dear Support,

I use the following code to copy selected row details.

Instead of copying the whole row, I want to programmatically copy just one column of that row. 

Can you please give us a sample code?

************existing code**********

if (args.Item.Id == "copy")

                                        {

                                            this.Grid.Copy(false);

}


1 Reply

RN Rahul Narayanasamy Syncfusion Team October 22, 2021 02:09 PM UTC

Hi DAN, 

Greetings from Syncfusion. 

Query: Instead of copying the whole row, I want to programmatically copy just one column of that row. Can you please give us a sample code? 

We have validated your query and we suspect that you want to copy the particular cell value instead of copying the whole row value. You can achieve your requirement by setting Cell Selection Mode as Cell. You can select particular cell and copy the value. Find the below code snippets and sample for your reference. 

<SfButton OnClick="Copy" Content="Copy"></SfButton> 
<SfButton OnClick="CopyHeader" Content="Copy With Header"></SfButton> 
<SfGrid @ref="DefaultGrid" AllowSelection="true" DataSource="@Orders"> 
<GridSelectionSettings CellSelectionMode="CellSelectionMode.Box" Mode="SelectionMode.Cell"  
Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></GridSelectionSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        . ..  
    </GridColumns> 
</SfGrid> 


Reference: 

Please let us know if you have any concerns. 

Regards, 
Rahul 


Loader.
Up arrow icon