System.Web.UI.WebControls.LoginView.ViewChanged Event

Occurs after the view is changed.

Syntax

public event EventHandler ViewChanged

Remarks

When the System.Web.UI.WebControls.LoginView control switches views, it removes the controls from the previous template and creates new child controls from the new template. The LoginView.ViewChanged event is raised after the new child controls are created.

Use the LoginView.ViewChanged event to perform any processing, such as data binding, necessary to initialize the controls on the new view.

Note:

The LoginView.ViewChanged event is only raised if the login status for a user changes during a postback to the page. The LoginView.ViewChanged event will not be raised if a user logs in using the System.Web.UI.WebControls.Login control, or if the user logs out using the System.Web.UI.WebControls.LoginStatus control. The LoginView.ViewChanged event will also not occur if a user is logged in or out followed by a redirect. An example of when the LoginView.ViewChanged event will occur is when a user is logged out by calling the System.Web.Security.FormsAuthentication.SignOut method without being redirected to another page. During the next postback to the page, the System.Web.UI.WebControls.LoginView control will detect the change in the login status for the user, and then raise the LoginView.ViewChanged event.

For more information about handling events, see Handling and Raising Events.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0