RadGrid for ASP.NET AJAX

RadControls for ASP.NET AJAX

Each GridTableView has a property NoRecordsTemplate . This property defines a template that will be displayed if there are no records in the assigned DataSource.

There are cases in which you may want to show an empty grid rather than this template. There is a boolean property EnableNoRecordsTemplate which defines whether GridTableView will use the defined NoRecordsTemplate or not.

The NoRecordsTemplate should be populated for each detail table (in case of hierarchical grids) in the DetailTableDataBind event.

You can control the visibility of the table/NoRecordsTemplate controls by using corresponding Controls(0), Controls(1) of each GridTableView. This should happen after it was data-bound.

CopyASPX
<telerik:RadGrid ID="RadGrid1" runat="server">
  <MasterTableView>
    <NoRecordsTemplate>
      <div>
        There are no records to display</div>
    </NoRecordsTemplate>
  </MasterTableView>
</telerik:RadGrid>

Define NoRecordsTemplate programmatically

You need to design your custom class (holding the set of controls for the NoRecordsTemplate ) which implements the ITemplate interface. Then you can assign an instance of this class to the NoRecordsTemplate of the corresponding GridTableView.

The example below shows how to embed MS Label in the NoRecordsTemplate of the MasterTableView at runtime:

Detailed information about how to create templates programmatically you can find in the MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vstechart.asp