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

其中一個 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 為 ,則文字會顯示在選項按鈕的左邊。

適用於

另請參閱