Solved

Deselect Grid view Row

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

Title # Comments Views Activity
VB.NET 1 23
Batch file or script with password 22 44
How to parse the string and split the sub directory names in asp.net 7 42
VB.net and sql server 4 36
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 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