LoginView.OnPreRender(EventArgs) 方法

定义

根据登录用户的角色确定显示哪个角色组模板。Determines which role-group template to display, based on the roles of the logged-in user.

protected public:
 override void OnPreRender(EventArgs ^ e);
protected internal override void OnPreRender (EventArgs e);
override this.OnPreRender : EventArgs -> unit
Protected Friend Overrides Sub OnPreRender (e As EventArgs)

参数

e
EventArgs

包含事件数据的 EventArgs 对象。An EventArgs object that contains the event data.

注解

OnPreRender 事件中调用方法 PreRender ,以确定要向用户显示的内容模板。The OnPreRender method is called during the PreRender event to determine which content template to display to the user. 如果 Name 属性的属性 Page User 为,则将 null 显示在属性中指定的模板 AnonymousTemplate ; 否则,将显示与用户角色关联的模板。If the Name property of the PageUser property is null, the template specified in the AnonymousTemplate property is displayed; otherwise, the template associated with the user's role is displayed. 如果用户不属于已定义的角色组,或未配置角色管理,则该 LoginView 控件将显示在属性中指定的模板 LoggedInTemplateIf the user does not belong to a defined role group, or if you have not configured role management, the LoginView control displays the template specified in the LoggedInTemplate property. 有关配置角色管理的详细信息,请参阅 角色管理提供程序For more information about configuring role management, see Role Management Providers.

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息,请参阅 处理和引发事件For more information, see Handling and Raising Events.

OnPreRender 方法还允许派生类对事件进行处理而不必附加委托。The OnPreRender method also allows derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

继承者说明

在派生类中重写 OnPreRender(EventArgs) 时,一定要调用基类的 OnPreRender(EventArgs) 方法,以便已注册的委托对事件进行接收。When overriding OnPreRender(EventArgs) in a derived class, be sure to call the base class's OnPreRender(EventArgs) method so that registered delegates receive the event.

适用于