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.
Unfortunately, activation email could not send to your email. Please try again.

How to remove and clear entire records from SfDataGrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 02:12 AM

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.

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.

;