No records text in RadGridView without using behaviors

Thread is closed for posting
5 posts, 0 answers
  1. DF56C013-23EB-4AFD-827A-FA3B1B5D207F
    DF56C013-23EB-4AFD-827A-FA3B1B5D207F avatar
    78 posts
    Member since:
    Sep 2009

    Posted 01 Sep 2010 Link to this post

    Requirements

    RadControls version

    2010.2.812.1040

    .NET version

    4

    Visual Studio version

    2010

    programming language

    c#

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    Most often we want to show a "No records found..." message on the grid when there are no records bound to the grid. This project demonstrates how to create a custom RadGridView to handle this.

    The custom grid takes care of
    - not showing the no records message on load on a empty grid
    - showing the "no records" message when no data is bound (probably as a result of searh results)
    - hiding the "no records" message.

    The grid has 2 dependency properties
    - HasNoRecords (bool?)
    - NoRecordsText (string)

    Of the above 2 properties, HasNoRecords needs be to bound to a bool? value in the views view model (or code behind) which identifies if there are any records. The NoRecordsText may or may not be data bound. It can even be hardcoded as below.

    Useage is as simple as below

    <NoRecordsGridView:CustomRadGrid Grid.Row="0" ItemsSource="{Binding DataItems}" AutoGenerateColumns="True" HasNoRecords="{Binding HasNoRecords}" NoRecordsText="No data found..."/>

    Please provide your feedback on this.

    Cheers,
    Ganesh
  2. BC15671C-7791-4A43-B112-9EB0F6DED23E
    BC15671C-7791-4A43-B112-9EB0F6DED23E avatar
    1989 posts
    Member since:
    Jul 2013

    Posted 01 Sep 2010 Link to this post

    Hello Ganesh Shivshankar,

    Thank you sharing this code with the community. Your Telerik points have been updated. 


    Regards,
    Milan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. D3E2D5BC-4742-45E6-88A9-19D94F69AA25
    D3E2D5BC-4742-45E6-88A9-19D94F69AA25 avatar
    66 posts
    Member since:
    Aug 2010

    Posted 01 Feb 2012 Link to this post

    when i run ur code am getting this error.

    The type 'CustomRadGrid' was not found. [Line: 10 Position: 168].

    in my application am added the norecordsgridview namespace and customradgrid class file also.
    am getting the property content is set more then once error for this line.
    here am sending my code.

    <telerik:RadGridView x:Name="rgvMeterReads" ItemsSource="{Binding Data}" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" Margin="0,0,0,0" ShowGroupPanel="False" AlternateRowBackground="#FFFF66" AlternationCount="2" ShowColumnHeaders="True" RowIndicatorVisibility="Collapsed" RowHeight="15" Width="1000" Height="auto">
                              
                                <telerik:RadGridView.Resources>
                                    <Style TargetType="telerik:GridViewHeaderCell">
                                        <Setter Property="Background" Value="Transparent"/>
                                        <Setter Property="Foreground" Value="Black" />
                                        <Setter Property="BorderBrush" Value="Blue"/>
                                    </Style>
                                </telerik:RadGridView.Resources>
                                <telerik:RadGridView.HeaderRowStyle>
                                    <Style TargetType="telerik:GridViewHeaderRow">
                                        <Setter Property="Background" Value="#66CCFF" />
                                    </Style >
                                </telerik:RadGridView.HeaderRowStyle>
                            </telerik:RadGridView>

                        <NoRecordsGridView:CustomRadGrid Grid.Row="0" ItemsSource="{Binding DataItems}" AutoGenerateColumns="True" HasNoRecords="{Binding HasNoRecords}" NoRecordsText="No data found..."/>
  4. 03C6DCCC-BDEA-48C2-8B34-F4A2A58C63A8
    03C6DCCC-BDEA-48C2-8B34-F4A2A58C63A8 avatar
    3769 posts
    Member since:
    Aug 2017

    Posted 26 Dec 2012 Link to this post

    Hi,

    I have modified the project slightly and update it with the latest binaries. You can find it attached.

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. D1C82C2C-7BE0-4B93-A661-F37317014AF4
    D1C82C2C-7BE0-4B93-A661-F37317014AF4 avatar
    3 posts
    Member since:
    Feb 2011

    Posted 11 Oct 2018 Link to this post

    Hi,

     

    Is there a built in functionality for this in the RadGrid nowadays?

    Thanks,

    Abner

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.