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.

Showing message in a row when no data in SfGrid

Thread ID:





130110 Apr 22,2017 02:40 AM Apr 24,2017 09:53 PM UWP 1
Tags: SfDataGrid
Asked On April 22, 2017 02:40 AM

Hi ,
     I am using sfDatagrid to show some data , it's working perfect. But when there is no data it shows empty grid, Instead of this I want to show some message in a first row of grid like "No Records found" when the list of data is empty/null. Please give me solution for my requirement.


Attachment: Grid_d773fde8.zip

Muthukumar Kalyanasundaram [Syncfusion]
Replied On April 24, 2017 09:53 PM

Hi Murali, 
Thank you for contacting Syncfusion support. 
We have analyzed your query. You can achieve your requirement by handling ItemsSourceChanged event. In the event, we have checked with dataGrid.ItemSource as empty or not. If dataGrid.ItemSource as null, then enable the visibility of textblock as shown like below code, 
Code Snippet: 
this.dataGrid.ItemsSourceChanged += DataGrid_ItemsSourceChanged; 
private void DataGrid_ItemsSourceChanged(object sender, GridItemsSourceChangedEventArgs e) 
    if (dataGrid.View != null && (this.dataGrid.DataContext as UserInfoViewModel).UserDetails.Count != 0) 
        txtBlock.Visibility = Visibility.Collapsed; 
        txtBlock.Visibility = Visibility.Visible; 
Please let us know if you have any query. 
Muthukumar K 


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.