I have a simple loginview on a webpage. If a user is logged out they are prompted with a login control. If they do, I have a label in the LoggedInTemplate with no text value. I have programmatically set a text value through the ViewChanged Event. However, when I log in, nothing appears. It seems to me, that the ViewChanged Event is not firing. My code is in the file attached.

Thank you

Robert

MSDN Documentation says...

The ViewChanged event is only raised if the login status for a user changes during a postback to the page. The ViewChanged event will not be raised if a user logs in using the Login control, or if the user logs out using the LoginStatus control. The ViewChanged event will also not occur if a user is logged in or out followed by a redirect.

As mentioned by you, the ViewChanged event will not occur when you logs-in and therefore nothing will be displayed in the Label in the LoggedInTemplate.

Cool,

So what can we do to make sure that it does fire?

Regards

Rob

Refer this link. http://forums.asp.net/p/899295/978972.aspx#978972

It clearly tells about when the change events will occur in the LoginView control with sample scenario. Though the thread discuss about LoginView control in the beta 2 version, there is no much difference between beta 2 and current version(RTM) of LoginView ViewChange events.

You can then change your code accordingly based on your requirement .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.