Monday, May 14, 2012

How do I handle LoginStatus control click?

Am using ASP.NET 4.0 with a LoginStatus control in a Master page. When the status is 'Login' and I click the link, the current page is attempted to be reloaded. I can see that IsPostBack=True.



If I use "Set Next Statement" to avoid my code in Page.Load the redirect to Login.aspx goes without a hitch, otherwise the current page tries to reload and for some reason it fails.



From Page.Load, what is the best way to detect that LoginStatus has been clicked? A click event handler won't work since it fires too late. IsPostBack won't work either (on its own). I do have a BaseMasterPage class that is inherited by my Master page, but again, the Master page loads after Page.Load in all of my pages.



Do I have to handle this click in every one of the pages that use this Master page?



Btw, I also have a BasePage class that all of my pages inherit. I'm just not sure how to detect that LoginStatus has been clicked - and if it has, how to handle it. Would I force a Redirect? That seems like overkill...





No comments:

Post a Comment