CreateUserWizard.UserName Propriedade

Definição

Obtém ou define o nome de utilizador introduzido pelo utilizador.

public:
 virtual property System::String ^ UserName { System::String ^ get(); void set(System::String ^ value); };
public virtual string UserName { get; set; }
member this.UserName : string with get, set
Public Overridable Property UserName As String

Valor de Propriedade

O nome de utilizador introduzido pelo utilizador. O valor padrão é uma cadeia vazia ("").

Exemplos

O exemplo de código seguinte define a UserName propriedade para todos os caracteres alfabéticos minúsculos no CreatingUser evento.

<%@ 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_LoggingIn(object sender, EventArgs e)
  {
    // Make user the UserName field is lower case before logging in.
    Createuserwizard1.UserName.ToLower();
  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>CreateUserWizard.LogginIn sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:createuserwizard id="Createuserwizard1" runat="server" 
        OnCreatingUser="Createuserwizard1_LoggingIn">
      </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_LoggingIn(ByVal sender As Object, ByVal e As LoginCancelEventArgs)
    ' Make sure the UserName field is lower case before logging in.
    Createuserwizard1.UserName.ToLower()
  End Sub

</script>

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

Observações

Se um nome de utilizador for exigido pelo fornecedor de membros especificado na MembershipProvider propriedade, então a caixa de texto do nome de utilizador aparecerá no CreateUserWizard controlo. Cada caixa de texto apresentada no CreateUserWizard controlo tem um RequiredFieldValidator objeto associado.

Aplica-se a

Ver também