Solved

Deselect Grid view Row

Posted on 2016-09-05
4
46 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 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