From: sjsean on
I have a gridview on a search page. When someone searches I want the
view to display a "new" button when either no results are returned or
some results are returned.

The problem I have currently is the "new" button shows upon initial
load of the page and I want to force people to search first.

How can I accomplish this?

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
PageSize="5"
GridLines="None" HorizontalAlign="Left"
ShowHeader="False">
<Columns>



<asp:HyperLinkField
DataNavigateUrlFields="location_id"
DataTextField="location_nickname"
DataNavigateUrlFormatString="default5.aspx?
location_id={0}"
NavigateUrl="~/Default5.aspx"></
asp:HyperLinkField>

<asp:TemplateField>

<FooterTemplate>
<table style="width: 104%">
<tr align="left" >

<td>
<asp:Button ID="Button2"
runat="server" onclick="Button2_Click"
Text="New Spot" />
</td>
</tr>
</table>
</FooterTemplate>
</asp:TemplateField>

</Columns>

<emptydatatemplate>
<table style="width: 104%">
<tr align="left" >

<td>
<asp:Button ID="Button2"
runat="server" onclick="Button2_Click"
Text="New Spot" />
</td>
</tr>
</table>
</emptydatatemplate>

</asp:GridView>