New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

No Data Template

The WebForms Chart allows you to configure a template that is rendered when no series are defined or all series are empty. This functionality is available through the NoDataTemplate property.

The demo shows how to configure the NoDataTemplate functionality to render a message for the user and a button to refresh the Chart by binding it to data. This enables developers to style the Chart according to the application needs.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • script.js
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.Web.Examples.HtmlChart.Functionality.NoDataTemplate.DefaultVB"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <script src="script.js"></script>
</head>

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-wide">
        <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1">
            <NoDataTemplate>
                <div class="empty-template">
                    <p>There is no data to display.</p>
                    <button onclick="onClick(); return false;">Load Data</button>
                </div>
            </NoDataTemplate>
            <ChartTitle Text="Spain electricity production (GWh)" />
            <PlotArea>
                <Series>
                    <telerik:ColumnSeries DataFieldY="nuclear" Name="Nuclear" />
                    <telerik:ColumnSeries DataFieldY="hydro" Name="Hydro" />
                    <telerik:ColumnSeries DataFieldY="wind" Name="Wind" />
                </Series>
            </PlotArea>
        </telerik:RadHtmlChart>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance