DropDownList 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表允許使用者從下拉式清單選取單一項目的控制項。
public ref class DropDownList : System::Web::UI::WebControls::ListControl, System::Web::UI::IPostBackDataHandler
[System.Web.UI.ValidationProperty("SelectedItem")]
public class DropDownList : System.Web.UI.WebControls.ListControl, System.Web.UI.IPostBackDataHandler
[<System.Web.UI.ValidationProperty("SelectedItem")>]
type DropDownList = class
inherit ListControl
interface IPostBackDataHandler
Public Class DropDownList
Inherits ListControl
Implements IPostBackDataHandler
- 繼承
- 繼承
- 屬性
- 實作
範例
具有原始程式碼的 Visual Studio 網站專案隨附于本主題: 下載。
下列程式碼範例示範如何建立包含四個專案 DropDownList 的控制項。
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server" >
void Selection_Change(Object sender, EventArgs e)
{
// Set the background color for days in the Calendar control
// based on the value selected by the user from the
// DropDownList control.
Calendar1.DayStyle.BackColor =
System.Drawing.Color.FromName(ColorList.SelectedItem.Value);
}
</script>
<head runat="server">
<title> DropDownList Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> DropDownList Example </h3>
Select a background color for days in the calendar.
<br /><br />
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br /><br />
<table cellpadding="5">
<tr>
<td>
Background color:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="ColorList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem Selected="True" Value="White"> White </asp:ListItem>
<asp:ListItem Value="Silver"> Silver </asp:ListItem>
<asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
<asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
<asp:ListItem Value="DarkKhaki"> Dark Khaki </asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server" >
Sub Selection_Change(sender As Object, e As EventArgs)
' Set the background color for days in the Calendar control
' based on the value selected by the user from the
' DropDownList control.
Calendar1.DayStyle.BackColor = _
System.Drawing.Color.FromName(ColorList.SelectedItem.Value)
End Sub
</script>
<head runat="server">
<title> DropDownList Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> DropDownList Example </h3>
Select a background color for days in the calendar.
<br /><br />
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br /><br />
<table cellpadding="5">
<tr>
<td>
Background color:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="ColorList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem Selected="True" Value="White"> White </asp:ListItem>
<asp:ListItem Value="Silver"> Silver </asp:ListItem>
<asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
<asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
<asp:ListItem Value="DarkKhaki"> Dark Khaki </asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</form>
</body>
</html>
下列程式碼範例示範如何透過資料系結建立 DropDownList 控制項。
<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server" >
void Selection_Change(Object sender, EventArgs e)
{
// Set the background color for days in the Calendar control
// based on the value selected by the user from the
// DropDownList control.
Calendar1.DayStyle.BackColor =
System.Drawing.Color.FromName(ColorList.SelectedItem.Value);
}
void Page_Load(Object sender, EventArgs e)
{
// Load data for the DropDownList control only once, when the
// page is first loaded.
if(!IsPostBack)
{
// Specify the data source and field names for the Text
// and Value properties of the items (ListItem objects)
// in the DropDownList control.
ColorList.DataSource = CreateDataSource();
ColorList.DataTextField = "ColorTextField";
ColorList.DataValueField = "ColorValueField";
// Bind the data to the control.
ColorList.DataBind();
// Set the default selected item, if desired.
ColorList.SelectedIndex = 0;
}
}
ICollection CreateDataSource()
{
// Create a table to store data for the DropDownList control.
DataTable dt = new DataTable();
// Define the columns of the table.
dt.Columns.Add(new DataColumn("ColorTextField", typeof(String)));
dt.Columns.Add(new DataColumn("ColorValueField", typeof(String)));
// Populate the table with sample values.
dt.Rows.Add(CreateRow("White", "White", dt));
dt.Rows.Add(CreateRow("Silver", "Silver", dt));
dt.Rows.Add(CreateRow("Dark Gray", "DarkGray", dt));
dt.Rows.Add(CreateRow("Khaki", "Khaki", dt));
dt.Rows.Add(CreateRow("Dark Khaki", "DarkKhaki", dt));
// Create a DataView from the DataTable to act as the data source
// for the DropDownList control.
DataView dv = new DataView(dt);
return dv;
}
DataRow CreateRow(String Text, String Value, DataTable dt)
{
// Create a DataRow using the DataTable defined in the
// CreateDataSource method.
DataRow dr = dt.NewRow();
// This DataRow contains the ColorTextField and ColorValueField
// fields, as defined in the CreateDataSource method. Set the
// fields with the appropriate value. Remember that column 0
// is defined as ColorTextField, and column 1 is defined as
// ColorValueField.
dr[0] = Text;
dr[1] = Value;
return dr;
}
</script>
<head runat="server">
<title> DropDownList Data Binding Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> DropDownList Data Binding Example </h3>
Select a background color for days in the calendar.
<br /><br />
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br /><br />
<table cellpadding="5">
<tr>
<td>
Background color:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="ColorList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server"/>
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server" >
Sub Selection_Change(sender as Object, e As EventArgs)
' Set the background color for days in the Calendar control
' based on the value selected by the user from the
' DropDownList control.
Calendar1.DayStyle.BackColor = _
System.Drawing.Color.FromName(ColorList.SelectedItem.Value)
End Sub
Sub Page_Load(sender as Object, e As EventArgs)
' Load data for the DropDownList control only once, when the
' page is first loaded.
If Not IsPostBack Then
' Specify the data source and field names for the Text
' and Value properties of the items (ListItem objects)
' in the DropDownList control.
ColorList.DataSource = CreateDataSource()
ColorList.DataTextField = "ColorTextField"
ColorList.DataValueField = "ColorValueField"
' Bind the data to the control.
ColorList.DataBind()
' Set the default selected item, if desired.
ColorList.SelectedIndex = 0
End If
End Sub
Function CreateDataSource() As ICollection
' Create a table to store data for the DropDownList control.
Dim dt As DataTable = New DataTable()
' Define the columns of the table.
dt.Columns.Add(new DataColumn("ColorTextField", GetType(String)))
dt.Columns.Add(new DataColumn("ColorValueField", GetType(String)))
' Populate the table with sample values.
dt.Rows.Add(CreateRow("White", "White", dt))
dt.Rows.Add(CreateRow("Silver", "Silver", dt))
dt.Rows.Add(CreateRow("Dark Gray", "DarkGray", dt))
dt.Rows.Add(CreateRow("Khaki", "Khaki", dt))
dt.Rows.Add(CreateRow("Dark Khaki", "DarkKhaki", dt))
' Create a DataView from the DataTable to act as the data source
' for the DropDownList control.
Dim dv As DataView = New DataView(dt)
Return dv
End Function
Function CreateRow(Text As String, Value As String, dt As DataTable) As DataRow
' Create a DataRow using the DataTable defined in the
' CreateDataSource method.
Dim dr As DataRow = dt.NewRow()
' This DataRow contains the ColorTextField and ColorValueField
' fields, as defined in the CreateDataSource method. Set the
' fields with the appropriate value. Remember that column 0
' is defined as ColorTextField, and column 1 is defined as
' ColorValueField.
dr(0) = Text
dr(1) = Value
Return dr
End Function
</script>
<head runat="server">
<title> DropDownList Data Binding Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> DropDownList Data Binding Example </h3>
Select a background color for days in the calendar.
<br /><br />
<asp:Calendar id="Calendar1"
ShowGridLines="True"
ShowTitle="True"
runat="server"/>
<br /><br />
<table cellpadding="5">
<tr>
<td>
Background color:
</td>
</tr>
<tr>
<td>
<asp:DropDownList id="ColorList"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server"/>
</td>
</tr>
</table>
</form>
</body>
</html>
備註
本主題內容:
簡介
DropDownList使用 控制項來建立單一選取清單控制項。 您可以藉由設定 BorderColor 、 BorderStyle 和 BorderWidth 屬性來控制控制項的外觀 DropDownList 。
若要指定您想要出現在 控制項中的 DropDownList 專案,請在控制項的開頭和結束記號 DropDownList 之間放置 ListItem 每個專案的 物件。
控制項 DropDownList 也支援資料系結。 若要將控制項系結至資料來源,請建立資料來源,例如 System.Collections.ArrayList 物件,其中包含要顯示在 控制項中的專案。 然後,使用 Control.DataBind 方法將資料來源系結至 DropDownList 控制項。
SelectedIndex使用 屬性,以程式設計方式判斷使用者從 DropDownList 控制項選取的專案索引。 然後,索引可用來從 Items
控制項的集合擷取選取的專案。
Accessibility
如需如何設定此控制項以產生符合協助工具標準的標記的相關資訊,請參閱 Visual Studio 中的協助工具,以及 ASP.NET 和 ASP.NET 控制項和協助工具。
宣告式語法
<asp:DropDownList
AccessKey="string"
AppendDataBoundItems="True|False"
AutoPostBack="True|False"
BackColor="color name|#dddddd"
BorderColor="color name|#dddddd"
BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
Inset|Outset"
BorderWidth="size"
CausesValidation="True|False"
CssClass="string"
DataMember="string"
DataSource="string"
DataSourceID="string"
DataTextField="string"
DataTextFormatString="string"
DataValueField="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"
Height="size"
ID="string"
OnDataBinding="DataBinding event handler"
OnDataBound="DataBound event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnSelectedIndexChanged="SelectedIndexChanged event handler"
OnTextChanged="TextChanged event handler"
OnUnload="Unload event handler"
runat="server"
SelectedIndex="integer"
SelectedValue="string"
SkinID="string"
Style="string"
TabIndex="integer"
ToolTip="string"
ValidationGroup="string"
Visible="True|False"
Width="size"
>
<asp:ListItem
Enabled="True|False"
Selected="True|False"
Text="string"
Value="string"
/>
</asp:DropDownList>
建構函式
DropDownList() |
初始化 DropDownList 類別的新執行個體。 |
屬性
AccessKey |
取得或設定便捷鍵 (Access Key),可讓您快速巡覽至 Web 伺服器控制項。 (繼承來源 WebControl) |
Adapter |
針對控制項取得瀏覽器的特定配置器。 (繼承來源 Control) |
AppendDataBoundItems |
取得或設定值,表示是否在資料繫結之前清除清單項目。 (繼承來源 ListControl) |
AppRelativeTemplateSourceDirectory |
取得或設定包含了此控制項之 Page 或 UserControl 物件的相對應用程式虛擬目錄。 (繼承來源 Control) |
Attributes |
取得任意屬性 (Attribute) 的集合 (只供呈現),不與控制項上的屬性 (Property) 對應。 (繼承來源 WebControl) |
AutoPostBack |
取得或設定值,表示當使用者變更清單選取項目時,是否會自動向伺服器回傳。 (繼承來源 ListControl) |
BackColor |
取得或設定 Web 伺服器控制項的背景色彩。 (繼承來源 WebControl) |
BindingContainer |
取得包含了此控制項之資料繫結的控制項。 (繼承來源 Control) |
BorderColor |
取得或設定控制項的框線色彩。 |
BorderStyle |
取得或設定控制項的框線樣式。 |
BorderWidth |
取得或設定控制項的框線寬度。 |
CausesValidation |
取得或設定值,表示是否要在按一下衍生自 ListControl 類別的控制項時執行驗證。 (繼承來源 ListControl) |
ChildControlsCreated |
取得值,指出是否已經建立伺服器控制項的子控制項。 (繼承來源 Control) |
ClientID |
取得 ASP.NET 所產生之 HTML 標記的控制項識別碼。 (繼承來源 Control) |
ClientIDMode |
取得或設定用來產生 ClientID 屬性值的演算法。 (繼承來源 Control) |
ClientIDSeparator |
取得字元值,表示在 ClientID 屬性中所使用的分隔字元。 (繼承來源 Control) |
Context |
取得與目前 Web 要求的伺服器控制項關聯的 HttpContext 物件。 (繼承來源 Control) |
Controls |
取得 ControlCollection 物件,表示 UI 階層架構中指定之伺服器控制項的子控制項。 (繼承來源 Control) |
ControlStyle |
取得 Web 伺服器控制項的樣式。 這個屬性主要由控制項開發人員使用。 (繼承來源 WebControl) |
ControlStyleCreated |
取得值,指出 Style 物件是否已經為 ControlStyle 屬性建立。 這個屬性主要由控制項開發人員使用。 (繼承來源 WebControl) |
CssClass |
取得或設定用戶端上 Web 伺服器控制項所呈現的階層式樣式表 (CSS)。 (繼承來源 WebControl) |
DataItemContainer |
如果命名容器實作 IDataItemContainer,則取得命名容器的參考。 (繼承來源 Control) |
DataKeysContainer |
如果命名容器實作 IDataKeysControl,則取得命名容器的參考。 (繼承來源 Control) |
DataMember |
取得或設定 DataSource 中要繫結至控制項的特定表格。 (繼承來源 ListControl) |
DataSource |
取得或設定可填入清單控制項項目的資料來源。 (繼承來源 ListControl) |
DataSourceID |
取得或設定控制項的識別碼,資料繫結控制項會由此擷取其項目清單。 (繼承來源 DataBoundControl) |
DataSourceObject |
取得物件,這個物件會實作可提供物件資料內容之存取權的 IDataSource 介面。 (繼承來源 DataBoundControl) |
DataTextField |
取得或設定提供清單項目文字內容的資料來源欄位。 (繼承來源 ListControl) |
DataTextFormatString |
取得或設定格式化字串,這個字串可用來控制繫結至清單控制項之資料的顯示方式。 (繼承來源 ListControl) |
DataValueField |
取得或設定提供每個清單項目值的資料來源欄位。 (繼承來源 ListControl) |
DesignMode |
取得值,指出控制項是否正用於設計介面上。 (繼承來源 Control) |
Enabled |
取得或設定值,指出 Web 伺服器控制項是否啟用。 (繼承來源 WebControl) |
EnableTheming |
取得或設定值,指出佈景主題是否套用至此控制項。 (繼承來源 WebControl) |
EnableViewState |
取得或設定值,該值表示伺服器控制項是否對要求的用戶端而言保持其檢視狀態,以及它包含的任何子控制項狀態。 (繼承來源 Control) |
Events |
取得控制項事件處理常式委派 (Delegate) 的清單。 這個屬性是唯讀的。 (繼承來源 Control) |
Font |
取得與 Web 伺服器控制項關聯的字型屬性。 (繼承來源 WebControl) |
ForeColor |
取得或設定 Web 伺服器控制項的前景色彩 (通常是文字的色彩)。 (繼承來源 WebControl) |
HasAttributes |
取得值,指出控制項是否已經設定屬性。 (繼承來源 WebControl) |
HasChildViewState |
取得值,指出目前伺服器控制項的子控制項是否有任何已儲存的檢視狀態設定。 (繼承來源 Control) |
Height |
取得或設定 Web 伺服器控制項的高度。 (繼承來源 WebControl) |
ID |
取得或設定指派給伺服器控制項的程式設計識別項。 (繼承來源 Control) |
IdSeparator |
取得用來分隔控制項識別項的字元。 (繼承來源 Control) |
Initialized |
取得值,指出是否已初始化資料繫結控制項。 (繼承來源 BaseDataBoundControl) |
IsBoundUsingDataSourceID |
取得值,指出是否已設定 DataSourceID 屬性。 (繼承來源 BaseDataBoundControl) |
IsChildControlStateCleared |
取得值,指出這個控制項中所包含的控制項是否有控制項狀態。 (繼承來源 Control) |
IsDataBindingAutomatic |
取得值,指出資料繫結是否為自動。 (繼承來源 BaseDataBoundControl) |
IsEnabled |
取得值,指出是否啟用控制項。 (繼承來源 WebControl) |
IsTrackingViewState |
取得值,指出伺服器控制項是否正在儲存檢視狀態的變更。 (繼承來源 Control) |
IsUsingModelBinders |
取得值,指出模型繫結是否正在使用。 (繼承來源 DataBoundControl) |
IsViewStateEnabled |
取得值,指出這個控制項是否已啟用檢視狀態。 (繼承來源 Control) |
Items |
取得清單控制項中的項目集合。 (繼承來源 ListControl) |
ItemType |
取得或設定強型別資料繫結的資料項目型別名稱。 (繼承來源 DataBoundControl) |
LoadViewStateByID |
取得值,指出控制項是否依 ID (而不是索引) 參與載入其檢視狀態。 (繼承來源 Control) |
NamingContainer |
取得伺服器控制項命名容器的參考,其建立唯一命名空間,在具有相同 ID 屬性值的伺服器控制項之間作區別。 (繼承來源 Control) |
Page |
取得含有伺服器控制項的 Page 執行個體的參考。 (繼承來源 Control) |
Parent |
在網頁控制階層架構中取得伺服器控制項之父控制項的參考。 (繼承來源 Control) |
RenderingCompatibility |
取得值,這個值會指定將與呈現 HTML 相容的 ASP.NET 版本。 (繼承來源 Control) |
RequiresDataBinding |
取得或設定值,指出是否應該呼叫 DataBind() 方法。 (繼承來源 BaseDataBoundControl) |
SelectArguments |
取得 DataSourceSelectArguments 物件,當從資料來源控制項擷取資料時資料繫結控制項會使用它。 (繼承來源 DataBoundControl) |
SelectedIndex |
取得或設定 DropDownList 控制項中選取之項目的索引。 |
SelectedItem |
取得清單控制項中具有最低索引的選取項目。 (繼承來源 ListControl) |
SelectedValue |
取得清單控制項中選取項目的值,或選取清單控制項中包含指定值的項目。 (繼承來源 ListControl) |
SelectMethod |
為了讀取資料要呼叫的方法的名稱。 (繼承來源 DataBoundControl) |
Site |
當呈現在設計介面上時,取得裝載目前控制項之容器的資訊。 (繼承來源 Control) |
SkinID |
取得或設定要套用至控制項的面板。 (繼承來源 WebControl) |
Style |
取得文字屬性的集合,將呈現為 Web 伺服器控制項的外部標記上的樣式屬性。 (繼承來源 WebControl) |
SupportsDisabledAttribute |
取得值,這個值表示當控制項的 |
SupportsDisabledAttribute |
取得值,這個值表示當控制項的 |
SupportsDisabledAttribute |
取得值,這個值表示當控制項的 |
TabIndex |
取得或設定 Web 伺服器控制項的定位索引。 (繼承來源 WebControl) |
TagKey |
取得 ListControl 控制項的 HtmlTextWriterTag 值。 (繼承來源 ListControl) |
TagName |
取得控制項標記的名稱。 這個屬性主要由控制項開發人員使用。 (繼承來源 WebControl) |
TemplateControl |
取得或設定包含了此控制項之樣板的參考。 (繼承來源 Control) |
TemplateSourceDirectory |
取得包含目前伺服器控制項的 Page 或 UserControl 的虛擬目錄。 (繼承來源 Control) |
Text |
取得或設定 ListControl 控制項的 SelectedValue 屬性。 (繼承來源 ListControl) |
ToolTip |
取得或設定當滑鼠指標停留在控制項上方時顯示的工具提示文字。 |
ToolTip |
取得或設定當滑鼠指標停留在 Web 伺服器控制項時顯示的文字。 (繼承來源 WebControl) |
UniqueID |
取得伺服器控制項唯一的、符合階層架構的識別項。 (繼承來源 Control) |
ValidateRequestMode |
取得或設定值,指出控制項是否對來自瀏覽器的用戶端輸入檢查潛在的危險值。 (繼承來源 Control) |
ValidationGroup |
取得或設定控制項群組,衍生自 ListControl 類別的控制項會在回傳至伺服器時,針對這個群組進行驗證。 (繼承來源 ListControl) |
ViewState |
取得狀態資訊的字典,允許您在相同網頁的多個要求之間,儲存和還原伺服器控制項的檢視狀態。 (繼承來源 Control) |
ViewStateIgnoresCase |
取得值,指出 StateBag 物件是否不區分大小寫。 (繼承來源 Control) |
ViewStateMode |
取得或設定這個控制項的檢視狀態模式。 (繼承來源 Control) |
Visible |
取得或設定值,指出伺服器控制項是否會轉譯為頁面上的 UI。 (繼承來源 Control) |
Width |
取得或設定 Web 伺服器控制項的寬度。 (繼承來源 WebControl) |
方法
事件
CallingDataMethods |
正在呼叫資料方法時發生。 (繼承來源 DataBoundControl) |
CreatingModelDataSource |
正在建立 ModelDataSource 物件時發生。 (繼承來源 DataBoundControl) |
DataBinding |
發生於伺服器控制項繫結至資料來源時。 (繼承來源 Control) |
DataBound |
在伺服器控制項繫結至資料來源之後發生。 (繼承來源 BaseDataBoundControl) |
Disposed |
發生於伺服器控制項從記憶體釋放時,這是在要求 ASP.NET 網頁時,伺服器控制項生命週期的最後階段。 (繼承來源 Control) |
Init |
發生於初始化伺服器控制項時,是其生命週期中的第一個步驟。 (繼承來源 Control) |
Load |
發生於載入伺服器控制項至 Page 物件時。 (繼承來源 Control) |
PreRender |
在 Control 物件載入之後但在呈現之前發生。 (繼承來源 Control) |
SelectedIndexChanged |
當清單控制項的選取項目在發佈至伺服器期間變更時發生。 (繼承來源 ListControl) |
TextChanged |
當 Text 和 SelectedValue 屬性變更時發生。 (繼承來源 ListControl) |
Unload |
發生於伺服器控制項從記憶體卸載時。 (繼承來源 Control) |
明確介面實作
擴充方法
EnablePersistedSelection(BaseDataBoundControl) |
已淘汰.
啟用要保存於資料控制項中且支援選取和分頁的選項。 |
FindDataSourceControl(Control) |
傳回與指定之控制項的資料控制項相關聯的資料來源。 |
FindFieldTemplate(Control, String) |
傳回在指定之控制項的命名容器中所指定資料行的欄位樣板。 |
FindMetaTable(Control) |
傳回包含資料控制項的中繼資料表物件。 |
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應