How to display a message when GridView isn't populated
<p>I'm building a GridView based on what is passed on the previous page querystring.</p>

<p>Is there a way to display a message saying 'no records found' if the GridView isn't populated?  i.e. the query produces no records to populate the GridView.</p>

<p>code:</p>

<pre><code>&lt;div class="centergrid"&gt;
    &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource1" CssClass="bookgridview"&gt;
        &lt;Columns&gt;
            &lt;asp:TemplateField HeaderText="Choose"&gt;
            &lt;ItemTemplate&gt;
                 &lt;asp:HyperLink ID="lnkSelect" runat='server' NavigateUrl='&lt;%# String.Format("~/bookingform.aspx?ID={0}", Eval("ScheduleId")) %&gt;'&gt;Book&lt;/asp:HyperLink&gt;
            &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
            &lt;asp:BoundField DataField="TName" HeaderText="Name" SortExpression="TName" /&gt;
            &lt;asp:BoundField DataField="SDate" HeaderText="Date" SortExpression="SDate" DataFormatString="{0:d}" /&gt;
            &lt;asp:BoundField DataField="STime" HeaderText="Time" SortExpression="STime" /&gt;
            &lt;asp:BoundField DataField="TPriceadult" HeaderText="Price (Adult)" 
                SortExpression="TPriceadult" DataFormatString="{0:C}"  /&gt; 
            &lt;asp:BoundField DataField="TPricesenior" HeaderText="Price (Student/Senior)" 
                SortExpression="TPricesenior" DataFormatString="{0:C}"  /&gt; 
            &lt;asp:BoundField DataField="TPricechild" HeaderText="Price (Child)" 
                SortExpression="Tpricechild" DataFormatString="{0:C}"   /&gt; 
            &lt;asp:BoundField DataField="TDuration" HeaderText="Duration"
                SortExpression="TDuration" /&gt;
            &lt;asp:BoundField DataField="ScheduleId" HeaderText="ScheduleId" 
                SortExpression="ScheduleId"  Visible="False" /&gt;
        &lt;/Columns&gt;
    &lt;/asp:GridView&gt;

    &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="&lt;%$ ConnectionStrings:ChinatowndbConnString %&gt;" 
        SelectCommand="SELECT * FROM [vwSchedule] Where TourId=@tid"&gt;

        &lt;SelectParameters&gt;
            &lt;asp:QueryStringParameter DbType="Int32" Name="tid" QueryStringField="tourid" /&gt;
        &lt;/SelectParameters&gt;
    &lt;/asp:SqlDataSource&gt;
</code></pre>
