Solved

Deselect Grid view Row

Posted on 2016-09-05
4
35 Views
Last Modified: 2016-09-12
When I select a Gridview row i have code that finds a button in the gridview template and sets visible to ' True'

    Protected Sub gvLiveLearners_SelectedIndexChanged(sender As Object, e As EventArgs) Handles gvLiveLearners.SelectedIndexChanged

        Dim btnLiveL1 As Button = CType(gvLiveLearners.SelectedRow.FindControl("btnLiveL1"), Button)



        btnLiveL1.Visible = True


    End Sub

Open in new window


This all works fine however I can get it to hide the button when I De-select the row.  Help.   Thanks
0
Comment
Question by:edjones1
  • 2
  • 2
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 41784756
btnLiveL1.Visible = False
0
 

Author Comment

by:edjones1
ID: 41784864
Thanks but what I'm trying to achieve is this.

When I user selects a gridview Row, the button appears in that row.

However, once another row is selected, the button on the original row button should disappear and the button on the selected row appear.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 41785148
You could store the button set to visible in a variable of the class so you can easily set it to hidden when you wanted.

Something like:
Dim btnLiveL1 As Button = null   'class level member

Protected Sub gvLiveLearners_SelectedIndexChanged(sender As Object, e As EventArgs) Handles gvLiveLearners.SelectedIndexChanged

if btnLiveL1  is not null then btnLiveL1.Visible = false
        btnLiveL1  = CType(gvLiveLearners.SelectedRow.FindControl("btnLiveL1"), Button)

        btnLiveL1.Visible = True


    End Sub

Open in new window

0
 

Author Closing Comment

by:edjones1
ID: 41793835
Perfect, thanks
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now