System.Web 2.0.0.0 System.Web.UI.WebControls.WebControl System.ComponentModel.Designer("System.Web.UI.Design.WebControls.LoginNameDesigner,System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") System.ComponentModel.DefaultProperty("FormatString") System.ComponentModel.Bindable(false)

In this topic:

Introduction

Accessibility

Declarative Syntax

## Introduction

By default, the control displays the name contained in the property of the class. If the System.Web.UI.Page.User.Identity.Name property is empty, the control is not rendered.

If you are not familiar with the set of login controls available in ASP.NET, see ASP.NET Login Controls Overview before continuing. For a list of other topics related to login controls and membership, see Managing Users By Using Membership.

To change the text displayed by the control, set the property.

The control cannot be used outside the <form> tag on a Web page. Specifically, the cannot be used to put the user's name in the title of a page.

## Accessibility

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

## Declarative Syntax

`<asp:LoginName AccessKey="string" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CssClass="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" FormatString="string" Height="size" ID="string" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Style="string" TabIndex="integer" ToolTip="string" Visible="True|False" Width="size" />`

Displays the value of the System.Web.UI.Page.User.Identity.Name property.

- Constructor

  Creates a new instance of the control.

  Initializes the control to its default values.

  2.0.0.0
- Property
  System.ComponentModel.Localizable(true)
  System.ComponentModel.DefaultValue("{0}")
  System.String To be added.

  The property contains a standard text format string that displays the user's name on the Web page. The string "{0}" indicates where in the string the user's name is inserted. The following table describes the available property settings.

  Property setting

  Behavior

  Default ("{0}")

  The user's name is displayed when the user is logged on; otherwise, nothing is displayed.

  Same as default. To hide the control, set the property to false.

  "Welcome to my site, {0}."

  Displays the string "Welcome to my site, username." when the user is logged in. When the user is not logged in, nothing is displayed.

  "Welcome to my site."

  When the property is set to a string, the string is displayed when the user is logged in. Because the string does not contain "{0}", the user's name is not displayed. When the user is not logged in, nothing is displayed.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Provides a format item string to display.

  2.0.0.0
- Method
  2.0.0.0
  System.Void `` To be added.

  Renders the control to the specified control.

  The that receives the rendered output.
- Method
  System.Void `` To be added.

  Renders the HTML opening tag of the control to the specified writer.

  A object that represents the output stream that renders HTML content to the client. 2.0.0.0
- Method
  2.0.0.0
  System.Void `` To be added.

  Renders the contents of the control to the specified writer. This method is used primarily by control developers.

  A object that represents the output stream that renders HTML content to the client.
- Method
  System.Void `` To be added.

  Renders the HTML closing tag of the control to the specified writer.

  A object that represents the output stream that renders HTML content to the client. 2.0.0.0