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.
Syncfusion Feedback

Showing message in a row when no data in SfGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

130110 Apr 22,2017 06:40 AM UTC Apr 25,2017 01:53 AM UTC UWP 1
loading
Tags: SfDataGrid
MURALI KRISHNA
Asked On April 22, 2017 06:40 AM UTC

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.

Regards.

Attachment: Grid_d773fde8.zip

Muthukumar Kalyanasundaram [Syncfusion]
Replied On April 25, 2017 01:53 AM UTC

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; 
    } 
    else 
        txtBlock.Visibility = Visibility.Visible; 
} 
 
 
 
Please let us know if you have any query. 
 
Regards, 
Muthukumar K 


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

;