RadioButtonList.TextAlign 属性

定义

获取或设置组内单选按钮的文本对齐方式。

public:
 virtual property System::Web::UI::WebControls::TextAlign TextAlign { System::Web::UI::WebControls::TextAlign get(); void set(System::Web::UI::WebControls::TextAlign value); };
[System.ComponentModel.Bindable(true)]
public virtual System.Web.UI.WebControls.TextAlign TextAlign { get; set; }
public virtual System.Web.UI.WebControls.TextAlign TextAlign { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.TextAlign : System.Web.UI.WebControls.TextAlign with get, set
member this.TextAlign : System.Web.UI.WebControls.TextAlign with get, set
Public Overridable Property TextAlign As TextAlign

属性值

TextAlign 值之一。 默认值为 Right

属性

例外

与单选按钮关联的标签文本对齐方式不是 TextAlign 值之一。

示例

下面的代码示例演示如何使用 TextAlign 属性在控件左侧 RadioButtonList 显示与单选按钮关联的文本。

<%@ Page Language="C#" AutoEventWireup="True" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>RadioButtonList.TextAlign Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      RepeatColumns = "2" 
      RepeatDirection="Vertical" 
      RepeatLayout="Table"  
      TextAlign="Left"  
      runat="server">
 
    <asp:ListItem>Item 1</asp:ListItem>
    <asp:ListItem>Item 2</asp:ListItem>
    <asp:ListItem>Item 3</asp:ListItem>
    <asp:ListItem>Item 4</asp:ListItem>
    <asp:ListItem>Item 5</asp:ListItem>
    <asp:ListItem>Item 6</asp:ListItem>
 
 </asp:RadioButtonList>
</body>
</html>

注解

使用此属性可以指定与单选按钮关联的文本是显示在左侧还是右侧。 如果此属性设置为 TextAlign.Right,文本将显示在单选按钮的右侧。 如果此属性设置为 TextAlign.Left,文本将显示在单选按钮的左侧。

适用于

另请参阅