GridView Question

S

sjsean

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top