473,382 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Make button invisible

Hello,

I have a link button which signs out the user when it is clicked.

I place on by button the code line ibLogout.Visible =
My.User.IsAuthenticated.

So, when the user is authenticated the button logout is visible.
Otherwise is invisible.

There is a problem:

When I click logout the button does not get invisible. I need to
click it again or refresh the page so it takes effect.

Could someone, please help me out with this?

I believe this has something to do with the load, init, etc events.

Here is my code:

1 Private Sub lbLogout_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lbLogout.Load
2 With lbLogout
3 .ID = "lbLogout"
4 .Text = "logout"
5 .Visible = My.User.IsAuthenticated
6 End With
7 End Sub
8 Private Sub lbLogout_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles lbLogout.Click
9 FormsAuthentication.SignOut()
10 End Sub ' lbLogout_Click

Thank You,

Miguel

Dec 11 '06 #1
1 3094
Howdy,

It's obvious because you're setting visibility on page_load event handler,
and you're calling FormsAuthentication.SignOut()
in the lbLogout_Click which occurs after Page_Load event (visibility is
already set).
You have to set visibility again:

1 Private Sub lbLogout_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lbLogout.Load
2 With lbLogout
3 .ID = "lbLogout"
4 .Text = "logout"
5 .Visible = My.User.IsAuthenticated
6 End With
7 End Sub
8 Private Sub lbLogout_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles lbLogout.Click
9 FormsAuthentication.SignOut()
lbLogout.Visible = False
10 End Sub ' lbLogout_Click

Hope this helps
--
Milosz Skalecki
MCAD
"shapper" wrote:
Hello,

I have a link button which signs out the user when it is clicked.

I place on by button the code line ibLogout.Visible =
My.User.IsAuthenticated.

So, when the user is authenticated the button logout is visible.
Otherwise is invisible.

There is a problem:

When I click logout the button does not get invisible. I need to
click it again or refresh the page so it takes effect.

Could someone, please help me out with this?

I believe this has something to do with the load, init, etc events.

Here is my code:

1 Private Sub lbLogout_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lbLogout.Load
2 With lbLogout
3 .ID = "lbLogout"
4 .Text = "logout"
5 .Visible = My.User.IsAuthenticated
6 End With
7 End Sub
8 Private Sub lbLogout_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles lbLogout.Click
9 FormsAuthentication.SignOut()
10 End Sub ' lbLogout_Click

Thank You,

Miguel

Dec 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PCB | last post by:
Hi all, Not sure if this is possible, but can I change the controls of a command button on a per record bases in a subform. In my case, I would like to make a command button visible only if...
6
by: Paul Turley | last post by:
Does anyone have some sample script to "press" a button or image button when the user presses the Enter key? I see this behavior on a lot of web pages but I'm not finding any samples. Thx --...
3
by: tshad | last post by:
I am using the footer of my Datalist to add a row into my database. Is there a way to make the footer invisible when not adding a row, making it visible when a button is pushed and making it...
2
by: Dave | last post by:
hi, I'm have a control which inherits from the panel control and I want to make it invisible at design time -- like the Timer control. Any suggestions?? Thanks, davermcl
1
by: esateesh | last post by:
how to make a print button invisible in the printed page when a print is given
2
by: zeroblade | last post by:
I want to make the text invisible until the user presses a button, after which the text would appear. How would I make the text invisible?
6
by: ghjk | last post by:
I have a menu which is contain image buttons. I want to hide some buttons in some pages. This is my code and it's not working. I couldn't find the error. Please help me. <script...
1
by: Marina Chitchi | last post by:
In detail section of access report I have txtProblem. I put a line under this text. I want to make line invisible if txtProblem is null and visible if it populated (by the recordsource.
4
KeredDrahcir
by: KeredDrahcir | last post by:
I want to be able to use CSS to make a button invisible but for people still be able to select it if they manage to mouse over. I have no control of the HTML of the button and though this might...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.