We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to remove and clear entire records from SfDataGrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

131509 Jul 14,2017 02:21 AM UTC Jul 14,2017 06:12 AM UTC Xamarin.Forms 1
loading
Tags: SfDataGrid
Gangatharan Baskaran
Asked On July 14, 2017 02:21 AM UTC

I'm using SfDataGrid in Xamarin forms and I want to clear the entire records from the SfDataGrid. Basically, I want to make the grid empty again. How can I do that in C#?

Ashok N [Syncfusion]
Replied On July 14, 2017 06:12 AM UTC

Hi Gangatharan, 

Thanks for contacting Syncfusion support. 

You can achieve your requirement by clearing the Binding ItemsSource. Please refer the below code example : 

<ContentPage.BindingContext> 
    <local:ViewModel x:Name="viewModel" /> 
</ContentPage.BindingContext> 

<sfgrid:SfDataGrid x:Name="dataGrid"  
            ItemsSource="{Binding OrdersInfo}" > 
</sfgrid:SfDataGrid> 

private void ClearRecords_Clicked(object sender, EventArgs e) 
{ 
    // Clear the records from view 
    viewModel.OrdersInfo.Clear(); 
} 


Regards, 
Ashok 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;