Export (0) Print
Expand All

Login.TitleTextStyle Property

Gets a reference to a collection of properties that define the appearance of the title text in the Login control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public TableItemStyle TitleTextStyle { get; }
/** @property */
public TableItemStyle get_TitleTextStyle ()

public function get TitleTextStyle () : TableItemStyle

Not applicable.

Property Value

A reference to the TableItemStyle that contains properties that define the appearance of title text.

The TitleTextStyle property gets a reference to a TableItemStyle object that you use to change the appearance of the title contained in the TitleText property.

The TitleTextStyle property defines the appearance of the title in the Login control. This property is read-only; however, you can set the properties of the TableItemStyle object it returns. You can set these properties declaratively in the form Property-Subproperty, where Subproperty represents a property of the TableItemStyle class (for example, TitleStyle-ForeColor). You can set the property programmatically in the form Property.Subproperty (for example, TitleStyle.ForeColor).

Common settings include custom background color, text color, and font properties. The TitleTextStyle property defines the appearance of the TitleText property.

The style settings for the TitleTextStyle property are merged with the style settings for the Login control. Any settings made in the TitleTextStyle property override the corresponding settings in properties of the Login control.

The following Login style properties are overridden by TitleTextStyle settings:

When you use templates to define the appearance of the Login control, the TitleTextStyle property has no effect.

The following code example sets the text color, background color, and font weight of the title by setting properties of the TableItemStyle object referenced by the TitleTextStyle property.

Security noteSecurity Note:

This example contains a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview (Visual Studio).

<%@ 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 changeClick(object sender, EventArgs e)
{
    Login1.TitleText = newTitle.Text;
}

void OnLoginError(object sender, EventArgs e)
{
    Login1.TitleTextStyle.BackColor = System.Drawing.Color.Red;
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <table style="text-align:center; border:1">
                <tr>
                    <td>
                        Title Text:
                    </td>
                    <td>
                        <asp:TextBox id="newTitle" runat="server">Login</asp:TextBox></td>
                    <td>
                        <asp:Button id="change" runat="server" onClick="changeClick" Text="Change"></asp:Button></td>
                </tr>
                <tr>
                    <td colspan="3" align="center">
                        <asp:Login id="Login1" runat="server" 
                            TitleText="Log In Now"
                            OnLoginError="OnLoginError">
                            <TitleTextStyle 
                                Font-Bold="True" 
                                ForeColor="#0000C0" 
                                BackColor="#E0E0E0">
                        </TitleTextStyle>
                        </asp:Login>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft