Hi again.

I have a gridview control on my page, and some search criteria textboxes, etc. When my user clicks 'Search', I want to show or hide an unrelated hyperlink based on the count returned by the grid. I'm having trouble figuring out when to do this. I started with the Page Load event, but it's not working. I've tried other (seemingly logical) events, but nothing works so far. Can anyone tell me when to do this? Many thanks! S--

<asp:GridView ID="GridView1" runat="server" 
            onselectedindexchanged="GridView1_SelectedIndexChanged">
        </asp:GridView>

 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //urcode
        }

Thanks, kdcorp87.

Don't I have to have clicked on a row to trigger onselectedindexchanged? What I'm trying to do doesn't depend on that. For example, when I first land on my page, the grid is showing nothing, and the hyperlink should be invisible, which is the default value. When the user clicks a button to initiate a search, I want to show this linkif 1 or more records were returned, or keep it hidden if nothing was returned - all before any rows are clicked.

I'm pondering a load or pre-event event, but still nothing works.

<asp:GridView ID="GridView1" runat="server" 
            onselectedindexchanged="GridView1_SelectedIndexChanged">
        </asp:GridView>

 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //urcode
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.