System.Web.UI.WebControls.LoginView.ViewChanging Event

Occurs before the view is changed.

Syntax

public event EventHandler ViewChanging

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.ViewChanging event is raised before the previous controls are removed.

Use the LoginView.ViewChanging event to perform any processing, such as saving control information, necessary before the controls are removed.

Note:

The LoginView.ViewChanging event is only raised if the login status for a user changes during a postback to the page. The LoginView.ViewChanging 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.ViewChanging event will also not occur if a user is logged in or out followed by a redirect. An example of when the LoginView.ViewChanging 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.ViewChanging 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