RadioButtonList.CellPadding 属性

定义

获取或设置表格单元格的边框和内容之间的距离(以像素为单位)。

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

属性值

Int32

表格单元格的边框和内容之间的距离(以像素为单位)。 默认值为 -1,指示未设置此属性。

属性

示例

下面的代码示例演示如何使用 CellPadding 属性将控件的 RadioButtonList 单元格填充为 10 像素。

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

<asp:RadioButtonList id="RadioButtonList1"
      CellPadding = "10"
      RepeatLayout="Table" 
      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>
<%@ Page Language="VB" AutoEventWireup="True" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>RadioButtonList.CellPadding Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      CellPadding = "10"
      RepeatLayout="Table" 
      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>

注解

仅当 RepeatLayout 属性设置为 RepeatLayout.Table 时才应用此属性。

使用此属性可控制单元格内容与单元格边框之间的间距。

指定的填充量将添加到单元格的所有四侧。 它使用表格中最高单元格的高度和表格中最宽单元格的宽度。 生成的单元格大小统一应用于表中的所有单元格。 无法指定单个单元格大小。

适用于

另请参阅