Solved

Deselect Grid view Row

Posted on 2016-09-05
4
40 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 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

22 Experts available now in Live!

Get 1:1 Help Now