Redigera

Dela via


CreateUserWizard.CreatingUser Event

Definition

Occurs before the membership provider is called to create the new Web site user account.

public:
 event System::Web::UI::WebControls::LoginCancelEventHandler ^ CreatingUser;
public event System.Web.UI.WebControls.LoginCancelEventHandler CreatingUser;
member this.CreatingUser : System.Web.UI.WebControls.LoginCancelEventHandler 
Public Custom Event CreatingUser As LoginCancelEventHandler 

Event Type

Examples

The following code example uses the CreatingUser event to make the UserName property all lowercase before submitting it to the membership provider specified in the MembershipProvider property.

<%@ page language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  
  void Createuserwizard1_CreatingUser (object sender, LoginCancelEventArgs e)
  {
    Createuserwizard1.UserName.ToLower();
  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>CreateUserWizard.CreatingUser sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:createuserwizard id="Createuserwizard1" runat="server" 
        oncreatinguser="Createuserwizard1_CreatingUser" >
      </asp:createuserwizard>
    </div>
    </form>
</body>
</html>
<%@ page language="VB"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  Sub Createuserwizard1_CreatingUser(ByVal sender As Object, ByVal e As LoginCancelEventArgs)
    Createuserwizard1.UserName.ToLower()
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>CreateUserWizard.CreatingUser sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:createuserwizard id="Createuserwizard1" runat="server" 
        oncreatinguser="Createuserwizard1_CreatingUser" >
      </asp:createuserwizard>
    </div>
    </form>
</body>
</html>

Remarks

The CreatingUser event is raised prior to calling the CreateUser method on the membership provider specified in the MembershipProvider property.

Use the CreatingUser event to establish defaults or modify the information entered by the user before passing the information to the membership provider.

For more information about how to handle events, see Handling and Raising Events.

Applies to

See also