Telerik blogs


One more RadGridView behavior frequently requested by our clients is to display a message when there are no records to display. A typical real life scenario would be a RadGridView displaying a list of search results. When there are no results found we would like to have a message like “No results found!” displayed in RadGridView.





If you download the project above , you will see that if you get the EmptyDataTemplateBehavior.cs into your project, setting the empty data template will be as easy as writing a few lines of XAML :

<telerik:RadGridView x:Name="RadGridView1" > 
 <TextBlock Text="No results found!" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding MessageVisibility}" /> 


*As you may know from my previous posts concerning attached behaviors , you will need  to add a reference to the System.Windows.Interactivity.dll.

*As always the same approach is applicable for the WPF version of RadGridView provided that you reference the right version of the System.Windows.Interactivity.dll.


Comments are disabled in preview mode.