LinqDataSource LinqDataSource LinqDataSource LinqDataSource Class

定義

在 ASP.NET Web 網頁中透過標記文字啟用 Language-Integrated Query (LINQ),以從資料物件擷取和修改資料。Enables the use of Language-Integrated Query (LINQ) in an ASP.NET Web page through markup text to retrieve and modify data from a data object.

public ref class LinqDataSource : System::Web::UI::WebControls::ContextDataSource, System::Web::DynamicData::IDynamicDataSource
[System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.LinqDataSource), "LinqDataSource.bmp")]
[System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.LinqDataSource), "LinqDataSource.ico")]
public class LinqDataSource : System.Web.UI.WebControls.ContextDataSource, System.Web.DynamicData.IDynamicDataSource
type LinqDataSource = class
    inherit ContextDataSource
    interface IDynamicDataSource
    interface IDataSource
Public Class LinqDataSource
Inherits ContextDataSource
Implements IDynamicDataSource
繼承
屬性
實作

範例

下列範例顯示LinqDataSource的控制項會從名為Products的實體類別抓取資料。The following example shows a LinqDataSource control that retrieves data from an entity class named Products. 實體類別可能已經使用O/R 設計工具O/R Designer或 SqlMetal 公用程式產生。The entity class could have been generated by using the O/R 設計工具O/R Designer or the SqlMetal.exe utility. 屬性會設定為只傳回Price屬性值大於50的記錄。 WhereThe Where property is set to return only records that have a value in the Price property greater than 50. 控制項系結LinqDataSource至控制項,以顯示資料。 GridViewA GridView control is bound to the LinqDataSource control to display the data.

<asp:LinqDataSource 
    ContextTypeName="ExampleDataContext" 
    TableName="Products" 
    Where="Price > 50"
    ID="LinqDataSource1" 
    runat="server">
</asp:LinqDataSource>
<asp:GridView 
    DataSourceID="LinqDataSource1"
    ID="GridView1" 
    runat="server">
</asp:GridView>
<asp:LinqDataSource 
    ContextTypeName="ExampleDataContext" 
    TableName="Products" 
    Where="Price > 50"
    ID="LinqDataSource1" 
    runat="server">
</asp:LinqDataSource>
<asp:GridView 
    DataSourceID="LinqDataSource1"
    ID="GridView1" 
    runat="server">
</asp:GridView>

下列範例顯示LinqDataSource的控制項可讓使用者在資料來源中更新、刪除和插入記錄。The following example shows a LinqDataSource control that enables users to update, delete, and insert records in the data source. 控制項系結LinqDataSource至控制項,可讓使用者查看及修改資料。 DetailsViewA DetailsView control is bound to the LinqDataSource control and enables users to see and modify the data. 請注意,若要選取、更新、刪除或插入記錄,則不需要任何 SQL 命令。Notice that no SQL commands are required in order to select, update, delete, or insert the records.

<asp:LinqDataSource 
    ContextTypeName="ExampleDataContext" 
    TableName="Products" 
    EnableUpdate="true"
    EnableInsert="true"
    EnableDelete="true"
    ID="LinqDataSource1" 
    runat="server">
</asp:LinqDataSource>
<asp:DetailsView 
    DataKeyNames="ProductID"
    AutoGenerateEditButton="true"
    AutoGenerateDeleteButton="true"
    AutoGenerateInsertButton="true"
    AllowPaging="true"
    DataSourceID="LinqDataSource1"
    ID="GridView1" 
    runat="server">
</asp:DetailsView>
<asp:LinqDataSource 
    ContextTypeName="ExampleDataContext" 
    TableName="Products" 
    EnableUpdate="true"
    EnableInsert="true"
    EnableDelete="true"
    ID="LinqDataSource1" 
    runat="server">
</asp:LinqDataSource>
<asp:DetailsView 
    DataKeyNames="ProductID"
    AutoGenerateEditButton="true"
    AutoGenerateDeleteButton="true"
    AutoGenerateInsertButton="true"
    AllowPaging="true"
    DataSourceID="LinqDataSource1"
    ID="GridView1" 
    runat="server">
</asp:DetailsView>

下列範例會顯示事件的事件處理常式Selecting ,其會根據網頁中的值來設定資料物件。The following example shows an event handler for the Selecting event that sets the data object based on a value in the Web page.

public partial class Default3 : System.Web.UI.Page
{
    string[] citiesArray = 
    { 
        "Atlanta", 
        "Charlotte", 
        "Denver", 
        "New York", 
        "San Francisco" 
    };

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void LinqDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        var cities = from city in citiesArray
                     where city.CompareTo("B") > 0
                     select city;
        e.Result = cities;
        // Or we could set e.Result = citiesArray to return all rows.
    }
}
Partial Class Default3
    Inherits System.Web.UI.Page

    Dim citiesArray() As String = _
    { _
        "Atlanta", _
        "Charlotte", _
        "Denver", _
        "New York", _
        "San Francisco" _
    }


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       
    End Sub

    
    Protected Sub LinqDataSource_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles LinqDataSource1.Selecting
        Dim cities = From city In citiesArray _
                     Where city > "B" _
                     Select city
        e.Result = cities
        ' Or we could set e.Result = citiesArray to return all rows.
    End Sub
    
End Class

下列範例顯示LinqDataSource的控制項已設定為按兩個數據行分組。The following example shows a LinqDataSource control that is configured to group by two columns. 屬性會參考具有兩個ProductCategory屬性的物件:和ColorKeyThe Key property references an object that has two properties, ProductCategory and Color. 所表示It的物件已重新命名為(別名Products)為。The object represented by It is renamed (aliased) to Products. 已重新Products命名的物件包含群組中個別記錄的集合。The renamed Products object contains a collection of the individual records in a grouping. 每個實例都會包含Products資料表中的所有資料行。Each instance will contain all the columns from the Products table.

<asp:LinqDataSource 
  ContextTypeName="ExampleDataContext" 
  TableName="Products" 
  GroupBy="new(ProductCategory, Color)"
  Select="new(Key,
          It As Products,
          Max(ListPrice) As MaxListPrice, 
          Min(ListPrice) As MinListPrice)"
  ID="LinqDataSource1" 
  runat="server">
</asp:LinqDataSource>
<asp:LinqDataSource 
  ContextTypeName="ExampleDataContext" 
  TableName="Products" 
  GroupBy="new(ProductCategory, Color)"
  Select="new(Key,
          It As Products,
          Max(ListPrice) As MaxListPrice, 
          Min(ListPrice) As MinListPrice)"
  ID="LinqDataSource1" 
  runat="server">
</asp:LinqDataSource>

下列範例顯示兩個ListView控制項,其中顯示上一個範例LinqDataSource中控制項的資料。The following example shows two ListView controls that display the data from the LinqDataSource control in the previous example. 一個ListView控制項會顯示群組的資料,另ListView一個控制項會顯示屬於該群組之產品的個別名稱。One ListView control displays the grouped data, and the other ListView control displays the individual names of products that belong to that group. 嵌套的資料繫結控制項的DataSource屬性會設定為Products,這It是物件的別名。The nested data-bound control's DataSource property is set to Products, which is the alias for the It object.

<asp:ListView 
    DataSourceID="LinqDataSource1" 
    ID="ListView1" runat="server">

    <LayoutTemplate>
      <table id="Table1" 
          style="background-color:Teal;color:White" 
          runat="server" 
          class="Layout">
          
        <thead>
          <tr>
            <th><b>Product Category</b></th>
            <th><b>Color</b></th>
            <th><b>Highest Price</b></th>
            <th><b>Lowest Price</b></th>
          </tr>
        </thead>
        <tr runat="server" id="itemPlaceholder">
        </tr>
        
      </table>
    </LayoutTemplate>

    <ItemTemplate>
      <tr>
        <td><%# Eval("key.ProductCategory") %></td>
        <td><%# Eval("key.Color") %></td>
        <td><%# Eval("MaxListPrice") %></td>
        <td><%# Eval("MinListPrice") %></td>
      </tr>
      <tr>
        
        <td colspan="4" style="width:100%;background-color:White;color:Black">
          <asp:ListView 
            DataSource='<%# Eval("Products") %>' 
            runat="server" 
            ID="ListView2">

            <LayoutTemplate>
              <div runat="server" id="itemPlaceholder" />
            </LayoutTemplate>

            <ItemTemplate>
              <%# Eval("ProductName") %><br />
            </ItemTemplate>

          </asp:ListView> 
        </td>
      </tr>
    </ItemTemplate>
  </asp:ListView>
<asp:ListView 
   DataSourceID="LinqDataSource1" 
   ID="ListView1" runat="server">

   <LayoutTemplate>
     <table id="Table1" 
         style="background-color:Teal;color:White" 
         runat="server" 
         class="Layout">
         
       <thead>
         <tr>
           <th><b>Product Category</b></th>
           <th><b>Color</b></th>
           <th><b>Highest Price</b></th>
           <th><b>Lowest Price</b></th>
         </tr>
       </thead>
       <tr runat="server" id="itemPlaceholder">
       </tr>
       
     </table>
   </LayoutTemplate>

   <ItemTemplate>
     <tr>
       <td><%# Eval("key.ProductCategory") %></td>
       <td><%# Eval("key.Color") %></td>
       <td><%# Eval("MaxListPrice") %></td>
       <td><%# Eval("MinListPrice") %></td>
     </tr>
     <tr>
       
       <td colspan="4" style="width:100%;background-color:White;color:Black">
         <asp:ListView 
           DataSource='<%# Eval("Products") %>' 
           runat="server" 
           ID="ListView2">

           <LayoutTemplate>
             <div runat="server" id="itemPlaceholder" />
           </LayoutTemplate>

           <ItemTemplate>
             <%# Eval("ProductName") %><br />
           </ItemTemplate>

         </asp:ListView> 
       </td>
     </tr>
   </ItemTemplate>
 </asp:ListView>

備註

本主題內容:In this topic:

簡介Introduction

語言整合式查詢(LINQ)是一種查詢語法,它會定義一組查詢運算子,讓您能夠在任何中以宣告方式表示的遍歷、篩選和投射作業。以網路為基礎的程式設計語言。Language-Integrated Query (LINQ) is a query syntax that defines a set of query operators that enable traversal, filter, and projection operations to be expressed in a declarative way in any .NET-based programming language. 資料物件可以是記憶體內部資料集合,或是代表資料庫資料的物件。The data object can be an in-memory data collection or an object that represents data from a database. 您可以抓取或修改資料,而不需要針對每個作業撰寫 SQL 命令。You can retrieve or modify the data without having to write SQL commands for each operation.

LinqDataSource控制項可讓您藉由設定標記文字中的屬性,在 ASP.NET 的網頁中使用 LINQ。The LinqDataSource control enables you to use LINQ in an ASP.NET Web page by setting properties in markup text. LinqDataSource控制項使用 LINQ to SQL 自動產生資料命令。The LinqDataSource control uses LINQ to SQL to automatically generate the data commands. 如需 LINQ to SQL 的詳細資訊,請參閱LINQ to SQLFor more information about LINQ to SQL, see LINQ to SQL.

當您從記憶體中的資料集合抓取資料時,會將ContextTypeName屬性設定為包含資料收集的類別。When you are retrieving data from an in-memory data collection, you set the ContextTypeName property to the class that contains the data collection. 您可以將TableName屬性設定為會傳回資料集合的屬性或欄位。You set the TableName property to the property or field that returns the data collection. 例如,您可能會有一個名為Person的類別,其中包含FavoriteCities名為的屬性,它會傳回字串值的陣列。For example, you might have a class named Person that contains a property named FavoriteCities that returns an array of string values. 在此情況下,您可以ContextTypeName將屬性Person設定為, TableName並將FavoriteCities屬性設定為。In that case, you set the ContextTypeName property to Person and set the TableName property to FavoriteCities.

當您查詢資料庫時,必須先建立代表資料庫和其資料表的實體類別。When you are querying a database, you must first create entity classes that represent the database and its tables. 您可以使用Object Relational DesignerObject Relational Designer或 SqlMetal 公用程式來產生這些類別。You can use the Object Relational DesignerObject Relational Designer or the SqlMetal.exe utility to generate these classes. 接著,您可以ContextTypeName將屬性設定為代表資料庫的類別,並TableName將屬性設定為代表資料庫資料表的屬性。You then set the ContextTypeName property to the class that represents the database and set the TableName property to the property that represents the database table.

作業順序Order of Operations

LinqDataSource控制項會依下列順序套用資料作業:The LinqDataSource control applies data operations in the following order:

  1. Where (指定要傳回的資料記錄)。Where (specify which data records to return).

  2. Order By (排序)。Order By (sort).

  3. 分組依據(共用值的匯總資料記錄)。Group By (aggregate data records that share values).

  4. 訂購群組依據(排序分組的資料)。Order Groups By (sort grouped data).

  5. 選取(指定要傳回的欄位或屬性)。Select (specify which fields or properties to return).

  6. 自動排序(依使用者選取的屬性排序資料記錄)。Auto-sort (sort data records by a property that the user has selected).

  7. 自動分頁(抓取使用者所選取的資料記錄子集)。Auto-page (retrieve a subset of data records that were selected by the user).

您可以將條件加入至Where屬性,以篩選從查詢傳回的資料記錄。You can add conditions to the Where property to filter the data records that are returned from a query. 如果未設定LinqDataSource屬性,控制項會從資料物件中抓取每筆記錄。 WhereIf the Where property is not set, the LinqDataSource control retrieves every record from the data object.

排序資料Ordering Data

您可以使用OrderBy屬性,從傳回的資料中指定要排序的屬性名稱。You use the OrderBy property to specify the names of properties from the returned data to sort by.

注意

LinqDataSource當您使用SQL Server 2000SQL Server 2000控制項搭配或SQL Server Compact 3.5SQL Server Compact 3.5 ,且AutoPage屬性設定為true時,您必須在OrderBy屬性中提供值。When you use the LinqDataSource control with SQL Server 2000SQL Server 2000 or SQL Server Compact 3.5SQL Server Compact 3.5 and the AutoPage property is set to true, you must provide a value in the OrderBy property. 根據預設, AutoPage屬性為trueBy default, the AutoPage property is true. 如果您將值指派給Select屬性,您也必須在查詢所傳回的屬性清單中包含所有識別欄位。If you assign a value to the Select property, you must also include all identity columns in the list of properties that is returned in the query.

分組資料Grouping Data

您可以使用GroupBy屬性來指定要使用哪些屬性來合併具有相同值的資料記錄。You use the GroupBy property to specify which properties are used to consolidate data records that have the same values. 當您群組資料時,您可以KeyIt Select屬性中包含和(也就是動態建立的屬性)。When you group data, you can include Key and It, which are dynamically created properties, in the Select property. Key屬性會參考屬性中的值,或用來分組資料的屬性。The Key property refers to the values in the property or properties that were used to group the data. 例如,如果您使用名為Category的屬性來分組Key ,屬性將會包含Category屬性中的所有唯一值。For example, if you group by a property named Category, the Key property will contain all unique values in the Category property. It屬性會參考資料群組中個別記錄的集合。The It property refers to a collection of individual records in a grouping of data. 您可以It逐一查看屬性,以取得已在群組作業中合併的個別記錄。You can iterate over the It property to retrieve the individual records that have been consolidated in the grouping operation. 例如,如果您使用名為Category的屬性來分組,則It屬性會包含共用Category屬性中通用值的所有個別記錄。For example, if you group by a property named Category, the It property contains all the individual records that share a common value in the Category property.

您可以使用OrderGroupsBy屬性來指定要用於排序群組資料的屬性。You use the OrderGroupsBy property to specify the properties to use for sorting the grouped data. 當您將資料分組時OrderBy ,屬性會指定如何排序群組資料內的個別記錄。When you group data, the OrderBy property specifies how the individual records within the grouped data are sorted.

根據預設, LinqDataSource控制項會從資料物件中抓取所有屬性的值。By default, the LinqDataSource control retrieves values for all the properties from a data object. 如果您想Select要使用可用屬性的子集,請使用屬性來指定要傳回的屬性。You use the Select property to specify which properties to return if you want to work with a subset of available properties. 選取作業會在 [Where]、[Order By] 和 [Group By] 作業之後套用。The Select operation is applied after the Where, Order By, and Group By operations. 因此,如果您在 Select 子句中建立別名名稱,別名就無法在其他子句中使用。Therefore, if you create an aliased name in a Select clause, the alias is not available in the other clauses.

資料修改Data Modifications

您可以使用EnableDeleteEnableInsertEnableUpdate屬性,指定是否要啟用資料修改。You can specify whether data modifications are enabled by using the EnableDelete, EnableInsert, and EnableUpdate properties. LinqDataSource控制項修改資料的使用者介面通常是透過資料繫結控制項(例如DetailsView控制項)提供。The user interface for modifying data from a LinqDataSource control is typically provided through a data-bound control, such as a DetailsView control. 除了將、 EnableInsertEnableDelete EnableUpdate設定為true之外,還需要下列條件來啟用自動資料修改:In addition to setting EnableDelete, EnableInsert, or EnableUpdate to true, the following conditions are required to enable automatic data modifications:

您可以使用兩種方式來限制要在資料繫結控制項中顯示的屬性。You can restrict which properties are displayed in a data-bound control in two ways. 您可以將Select屬性設定為屬性的子集,也可以藉由加入DataControlField控制項來定義資料繫結控制項的欄位。You can either set the Select property to a subset of properties, or you can define the fields for a data-bound control by adding DataControlField controls. 不過,如果您設定Select屬性,則表示無法啟用自動更新、插入和刪除作業。However, if you set the Select property, it means that automatic update, insert, and delete operations cannot be enabled. 如果您想要在使用可用屬性子集時啟用自動資料修改,請勿設定Select屬性。If you want to enable automatic data modifications while you work with a subset of available properties, do not set the Select property. 相反地,請從資料物件取出所有屬性,並使用資料繫結控制項來管理要顯示的內容。Instead, retrieve all properties from the data object and manage which ones are displayed by using the data-bound control. DetailsView您使用控制項AutoGenerateRows GridView或控制項時,也必須將或AutoGenerateColumns屬性設定為falseWhen you use the DetailsView control or the GridView control, you must also set the AutoGenerateRows or AutoGenerateColumns properties to false. 這可防止資料繫結控制項自動包含編輯和刪除資料的按鈕。This prevents the data-bound control from automatically including buttons for editing and deleting the data. 任何未顯示在資料繫結控制項中的值都會儲存在檢視狀態中。Any values that are not displayed in the data-bound control are stored in view state. 執行資料更新時,它們會原封不動地傳遞至資料來源。They are passed unchanged to the data source when the data update is performed.

在執行時間評估值Evaluating Values at Run Time

如果您必須在執行時間評估值以排序、篩選或群組值,您可以將參數新增WhereParameters至、 GroupByParametersOrderGroupsByParametersOrderByParameters集合。If you have to evaluate values at run time for ordering, filtering, or grouping values, you can add parameters to the WhereParameters, GroupByParameters, OrderGroupsByParameters, or OrderByParameters collections.

如果您想要指定預設值,您可以將參數新增至InsertParameters集合。If you want to specify default values, you can add parameters to the InsertParameters collection.

如果您想要在執行資料作業之前檢查或修改值,您Deleting可以處理SelectingInserting、或Updating事件。If you want to examine or modify values before the data operation is executed, you can handle the Deleting, Inserting, Selecting, or Updating events. 您也可以處理這些事件,以取消資料作業,或檢查當您根據使用者輸入設定資料類別中的屬性時所發生的驗證錯誤。You can also handle these events in order to cancel the data operation or to examine validation errors that occurred when you set properties in the data class based on user input.

若要在資料作業完成後檢查值,請處理DeletedInsertedSelectedUpdated事件。To examine values after the data operation has finished, handle the Deleted, Inserted, Selected, or Updated events.

使用預存程式Working with Stored Procedures

您可以使用LinqDataSource控制項,藉由建立Selecting事件的事件處理常式,從預存程式中取出資料。You use the LinqDataSource control to retrieve data from a stored procedure by creating an event handler for the Selecting event. 在事件處理常式中,您會在表示預存程式的資料內容類別中呼叫方法,並將結果設定ResultLinqDataSourceSelectEventArgs物件的屬性。In the event handler, you call the method in the data context class that represents the stored procedure and set the result to the Result property of the LinqDataSourceSelectEventArgs object. 如果您想要啟用資料的自動更新、插入和刪除作業,從方法傳回的類型必須符合TableName屬性中所指定的類型。If you want to enable automatic update, insert, and delete operations for the data, the type that is returned from the method must match the type that is specified in the TableName property. 如需建立資料內容方法的詳細資訊, 請參閱如何:建立對應至預存程序和函式的 DataContext 方法 (O/R 設計工具)For more information about creating data context methods, see How to: Create DataContext methods mapped to stored procedures and functions (O/R Designer).

宣告式語法Declarative Syntax

<asp:LinqDataSource  
    AutoGenerateOrderByClause="True|False"  
    AutoGenerateWhereClause="True|False"  
    AutoPage="True|False"  
    AutoSort="True|False"  
    ContextTypeName="string"  
    EnableDelete="True|False"  
    EnableInsert="True|False"  
    EnableTheming="True|False"  
    EnableUpdate="True|False"  
    EnableViewState="True|False"  
    GroupBy="string"  
    ID="string"  
    OnContextCreated="ContextCreated event handler"  
    OnContextCreating="ContextCreating event handler"  
    OnContextDisposing="ContextDisposing event handler"  
    OnDataBinding="DataBinding event handler"  
    OnDeleted="Deleted event handler"  
    OnDeleting="Deleting event handler"  
    OnDisposed="Disposed event handler"  
    OnInit="Init event handler"  
    OnInserted="Inserted event handler"  
    OnInserting="Inserting event handler"  
    OnLoad="Load event handler"  
    OnPreRender="PreRender event handler"  
    OnSelected="Selected event handler"  
    OnSelecting="Selecting event handler"  
    OnUnload="Unload event handler"  
    OnUpdated="Updated event handler"  
    OnUpdating="Updating event handler"  
    OrderBy="string"  
    runat="server"  
    Select="string"  
    SkinID="string"  
    StoreOriginalValuesInViewState="True|False"  
    TableName="string"  
    Visible="True|False"  
    Where="string"  
>  
        <GroupByParameters />  
        <InsertParameters />  
        <OrderByParameters />  
        <SelectParameters />  
        <WhereParameters />  
</asp:LinqDataSource>  

建構函式

LinqDataSource() LinqDataSource() LinqDataSource() LinqDataSource()

初始化 LinqDataSource 類別的新執行個體。Initializes a new instance of the LinqDataSource class.

屬性

Adapter Adapter Adapter Adapter

針對控制項取得瀏覽器的特定配置器。Gets the browser-specific adapter for the control.

(Inherited from Control)
AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory

取得或設定包含了此控制項之 PageUserControl 物件的相對應用程式虛擬目錄。Gets or sets the application-relative virtual directory of the Page or UserControl object that contains this control.

(Inherited from Control)
AutoGenerateOrderByClause AutoGenerateOrderByClause AutoGenerateOrderByClause AutoGenerateOrderByClause

取得或設定值,指出 LinqDataSource 控制項是否會根據 OrderByParameters 集合中的值,動態建立 ORDER BY 子句。Gets or sets a value that indicates whether the LinqDataSource control dynamically creates an Order By clause based on values in the OrderByParameters collection.

AutoGenerateWhereClause AutoGenerateWhereClause AutoGenerateWhereClause AutoGenerateWhereClause

取得或設定值,這個值表示 LinqDataSource 控制項是否根據 WhereParameters 集合中所定義的值動態地建立 Where 子句。Gets or sets a value that indicates whether the LinqDataSource control dynamically creates a Where clause based on values defined in the WhereParameters collection.

AutoPage AutoPage AutoPage AutoPage

取得或設定值,指出 LinqDataSource 控制項是否支援在執行階段完整瀏覽資料的區段。Gets or sets a value that indicates whether the LinqDataSource control supports navigation through sections of the data at run time.

AutoSort AutoSort AutoSort AutoSort

取得或設定值,指出 LinqDataSource 控制項是否支援在執行階段排序資料。Gets or sets a value that indicates whether the LinqDataSource control supports sorting the data at run time.

BindingContainer BindingContainer BindingContainer BindingContainer

取得包含了此控制項之資料繫結的控制項。Gets the control that contains this control's data binding.

(Inherited from Control)
ChildControlsCreated ChildControlsCreated ChildControlsCreated ChildControlsCreated

取得值,指出是否已經建立伺服器控制項的子控制項。Gets a value that indicates whether the server control's child controls have been created.

(Inherited from Control)
ClientID ClientID ClientID ClientID

取得 ASP.NET 產生的伺服器控制項識別項。Gets the server control identifier generated by ASP.NET.

(Inherited from DataSourceControl)
ClientIDMode ClientIDMode ClientIDMode ClientIDMode

這個屬性不會用於資料來源控制項。This property is not used for data source controls.

(Inherited from DataSourceControl)
ClientIDSeparator ClientIDSeparator ClientIDSeparator ClientIDSeparator

取得字元值,表示在 ClientID 屬性中所使用的分隔字元。Gets a character value representing the separator character used in the ClientID property.

(Inherited from Control)
Context Context Context Context

取得與目前 Web 要求的伺服器控制項關聯的 HttpContext 物件。Gets the HttpContext object associated with the server control for the current Web request.

(Inherited from Control)
ContextTypeName ContextTypeName ContextTypeName ContextTypeName

取得或設定型別的名稱,該型別所包含之屬性的值具有您要擷取的資料。Gets or sets the name of the type that contains the property whose value has the data that you want to retrieve.

Controls Controls Controls Controls

取得 ControlCollection 物件,表示 UI 階層架構中指定之伺服器控制項的子控制項。Gets a ControlCollection object that represents the child controls for a specified server control in the UI hierarchy.

(Inherited from DataSourceControl)
DataItemContainer DataItemContainer DataItemContainer DataItemContainer

如果命名容器實作 IDataItemContainer,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataItemContainer.

(Inherited from Control)
DataKeysContainer DataKeysContainer DataKeysContainer DataKeysContainer

如果命名容器實作 IDataKeysControl,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataKeysControl.

(Inherited from Control)
DeleteParameters DeleteParameters DeleteParameters DeleteParameters

LinqDataSource 類別不使用這個屬性。This property is not used by the LinqDataSource class.

DesignMode DesignMode DesignMode DesignMode

取得值,指出控制項是否正用於設計介面上。Gets a value indicating whether a control is being used on a design surface.

(Inherited from Control)
EnableDelete EnableDelete EnableDelete EnableDelete

取得或設定值,這個值表示是否可以透過 LinqDataSource 控制項刪除資料錄。Gets or sets a value that indicates whether data records can be deleted through the LinqDataSource control.

EnableInsert EnableInsert EnableInsert EnableInsert

取得或設定值,這個值表示是否可以透過 LinqDataSource 控制項插入資料錄。Gets or sets a value that indicates whether data records can be inserted through the LinqDataSource control.

EnableObjectTracking EnableObjectTracking EnableObjectTracking EnableObjectTracking

取得或設定值,這個值表示是否追蹤資料內容物件的變更。Gets or sets the value that indicates whether changes to the data context object are tracked.

EnableTheming EnableTheming EnableTheming EnableTheming

取得值,指出這個控制項是否支援佈景主題。Gets a value indicating whether this control supports themes.

(Inherited from DataSourceControl)
EnableUpdate EnableUpdate EnableUpdate EnableUpdate

取得或設定值,這個值表示是否可以透過 LinqDataSource 控制項更新資料錄。Gets or sets a value that indicates whether data records can be updated through the LinqDataSource control.

EnableViewState EnableViewState EnableViewState EnableViewState

取得或設定值,該值表示伺服器控制項是否對要求的用戶端而言保持其檢視狀態,以及它包含的任何子控制項狀態。Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client.

(Inherited from Control)
Events Events Events Events

取得控制項事件處理常式委派 (Delegate) 的清單。Gets a list of event handler delegates for the control. 這個屬性是唯讀的。This property is read-only.

(Inherited from Control)
GroupBy GroupBy GroupBy GroupBy

取得或設定值,這個值指定用於對擷取的資料進行分組的屬性。Gets or sets a value that specifies which properties are used for grouping the retrieved data.

GroupByParameters GroupByParameters GroupByParameters GroupByParameters

取得用於建立 Group By 子句的參數集合。Gets the collection of parameters that are used to create the Group By clause.

HasChildViewState HasChildViewState HasChildViewState HasChildViewState

取得值,指出目前伺服器控制項的子控制項是否有任何已儲存的檢視狀態設定。Gets a value indicating whether the current server control's child controls have any saved view-state settings.

(Inherited from Control)
IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder

如需這個成員的說明,請參閱 ControlBuilderFor a description of this member, see ControlBuilder.

(Inherited from Control)
IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData

如需這個成員的說明,請參閱 UserDataFor a description of this member, see UserData.

(Inherited from Control)
ID ID ID ID

取得或設定指派給伺服器控制項的程式設計識別項。Gets or sets the programmatic identifier assigned to the server control.

(Inherited from Control)
IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings

如需這個成員的說明,請參閱 DataBindingsFor a description of this member, see DataBindings.

(Inherited from Control)
IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings

如需這個成員的說明,請參閱 HasDataBindingsFor a description of this member, see HasDataBindings.

(Inherited from Control)
IdSeparator IdSeparator IdSeparator IdSeparator

取得用來分隔控制項識別項的字元。Gets the character used to separate control identifiers.

(Inherited from Control)
IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions

如需這個成員的說明,請參閱 ExpressionsFor a description of this member, see Expressions.

(Inherited from Control)
IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions

如需這個成員的說明,請參閱 HasExpressionsFor a description of this member, see HasExpressions.

(Inherited from Control)
IListSource.ContainsListCollection IListSource.ContainsListCollection IListSource.ContainsListCollection IListSource.ContainsListCollection

指示資料來源控制項是否與一個或多個資料清單產生關聯。Indicates whether the data source control is associated with one or more lists of data.

(Inherited from DataSourceControl)
InsertParameters InsertParameters InsertParameters InsertParameters

取得插入作業期間所使用的參數集合。Gets the collection of parameters that are used during an insert operation.

IsChildControlStateCleared IsChildControlStateCleared IsChildControlStateCleared IsChildControlStateCleared

取得值,指出這個控制項中所包含的控制項是否有控制項狀態。Gets a value indicating whether controls contained within this control have control state.

(Inherited from Control)
IsTrackingViewState IsTrackingViewState IsTrackingViewState IsTrackingViewState

取得值,指出伺服器控制項是否正在儲存檢視狀態的變更。Gets a value that indicates whether the server control is saving changes to its view state.

(Inherited from Control)
IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled

取得值,指出這個控制項是否已啟用檢視狀態。Gets a value indicating whether view state is enabled for this control.

(Inherited from Control)
LoadViewStateByID LoadViewStateByID LoadViewStateByID LoadViewStateByID

取得值,指出控制項是否依 ID (而不是索引) 參與載入其檢視狀態。Gets a value indicating whether the control participates in loading its view state by ID instead of index.

(Inherited from Control)
NamingContainer NamingContainer NamingContainer NamingContainer

取得伺服器控制項命名容器的參考,其建立唯一命名空間,在具有相同 ID 屬性值的伺服器控制項之間作區別。Gets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same ID property value.

(Inherited from Control)
OrderBy OrderBy OrderBy OrderBy

取得或設定值,這個值指定用於對擷取之資料進行排序的欄位。Gets or sets a value that specifies which fields are used for ordering the retrieved data.

OrderByParameters OrderByParameters OrderByParameters OrderByParameters

取得用於建立 Order By 子句的參數集合。Gets the collection of parameters that are used to create the Order By clause.

OrderGroupsBy OrderGroupsBy OrderGroupsBy OrderGroupsBy

取得或設定用於排序分組資料的欄位。Gets or sets the fields that are used for ordering grouped data.

OrderGroupsByParameters OrderGroupsByParameters OrderGroupsByParameters OrderGroupsByParameters

取得用來建立 Order Groups By 子句的參數集合。Gets the collection of parameters that are used to create the Order Groups By clause.

Page Page Page Page

取得含有伺服器控制項的 Page 執行個體的參考。Gets a reference to the Page instance that contains the server control.

(Inherited from Control)
Parent Parent Parent Parent

在網頁控制階層架構中取得伺服器控制項之父控制項的參考。Gets a reference to the server control's parent control in the page control hierarchy.

(Inherited from Control)
RenderingCompatibility RenderingCompatibility RenderingCompatibility RenderingCompatibility

取得值,這個值會指定將與呈現 HTML 相容的 ASP.NET 版本。Gets a value that specifies the ASP.NET version that rendered HTML will be compatible with.

(Inherited from Control)
Select Select Select Select

取得或設定屬性以及擷取之資料中包含的計算值。Gets or sets the properties and calculated values that are included in the retrieved data.

SelectParameters SelectParameters SelectParameters SelectParameters

取得擷取資料作業期間所使用的參數集合。Gets the collection of parameters that are used during a data-retrieval operation.

Site Site Site Site

當呈現在設計介面上時,取得裝載目前控制項之容器的資訊。Gets information about the container that hosts the current control when rendered on a design surface.

(Inherited from Control)
SkinID SkinID SkinID SkinID

取得套用至 DataSourceControl 控制項的面板。Gets the skin to apply to the DataSourceControl control.

(Inherited from DataSourceControl)
StoreOriginalValuesInViewState StoreOriginalValuesInViewState StoreOriginalValuesInViewState StoreOriginalValuesInViewState

取得或設定值,這個值表示資料來源的資料是否應在檢視狀態中進行儲存,以確定在更新或刪除資料前,資料未由另一個處理序變更。Gets or sets a value that indicates whether the data from the data source should be stored in view state to make sure that the data has not been changed by another process before it is updated or deleted.

TableName TableName TableName TableName

取得或設定資料內容類別中屬性或欄位的名稱,這個類別表示資料集合。Gets or sets the name of the property or field in the data context class that represents a data collection.

TemplateControl TemplateControl TemplateControl TemplateControl

取得或設定包含了此控制項之樣板的參考。Gets or sets a reference to the template that contains this control.

(Inherited from Control)
TemplateSourceDirectory TemplateSourceDirectory TemplateSourceDirectory TemplateSourceDirectory

取得包含目前伺服器控制項的 PageUserControl 的虛擬目錄。Gets the virtual directory of the Page or UserControl that contains the current server control.

(Inherited from Control)
UniqueID UniqueID UniqueID UniqueID

取得伺服器控制項唯一的、符合階層架構的識別項。Gets the unique, hierarchically qualified identifier for the server control.

(Inherited from Control)
UpdateParameters UpdateParameters UpdateParameters UpdateParameters

LinqDataSource 類別不使用這個集合。This collection is not used by the LinqDataSource class.

ValidateRequestMode ValidateRequestMode ValidateRequestMode ValidateRequestMode

取得或設定值,指出控制項是否對來自瀏覽器的用戶端輸入檢查潛在的危險值。Gets or sets a value that indicates whether the control checks client input from the browser for potentially dangerous values.

(Inherited from Control)
ViewState ViewState ViewState ViewState

取得狀態資訊的字典,允許您在相同網頁的多個要求之間,儲存和還原伺服器控制項的檢視狀態。Gets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page.

(Inherited from Control)
ViewStateIgnoresCase ViewStateIgnoresCase ViewStateIgnoresCase ViewStateIgnoresCase

取得值,指出 StateBag 物件是否不區分大小寫。Gets a value that indicates whether the StateBag object is case-insensitive.

(Inherited from Control)
ViewStateMode ViewStateMode ViewStateMode ViewStateMode

取得或設定這個控制項的檢視狀態模式。Gets or sets the view-state mode of this control.

(Inherited from Control)
Visible Visible Visible Visible

取得或設定值,指出是否視覺化顯示控制項。Gets or sets a value indicating whether the control is visually displayed.

(Inherited from DataSourceControl)
Where Where Where Where

取得或設定值,這個值指定針對要併入擷取之資料的資料錄,必須為 true 的條件。Gets or sets a value that specifies what conditions must be true for a record to be included in the retrieved data.

WhereParameters WhereParameters WhereParameters WhereParameters

取得用於建立 Where 子句的參數集合。Gets the collection of parameters that is used to create the Where clause.

方法

AddedControl(Control, Int32) AddedControl(Control, Int32) AddedControl(Control, Int32) AddedControl(Control, Int32)

在子控制項加入 Control 物件的 Controls 集合後呼叫。Called after a child control is added to the Controls collection of the Control object.

(Inherited from Control)
AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object)

通知伺服器控制項,XML 或 HTML 項目已剖析,並將項目加入伺服器控制項的 ControlCollection 物件中。Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object.

(Inherited from Control)
ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page)

將頁面樣式表中所定義的樣式屬性套用至控制項。Applies the style properties that are defined in the page style sheet to the control.

(Inherited from DataSourceControl)
BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object)

開始進行轉譯資料的設計階段追蹤。Begins design-time tracing of rendering data.

(Inherited from Control)
BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean)

收集伺服器控制項的相關資訊,並在頁面啟用追蹤時將此資訊傳遞至 Trace 屬性以顯示之。Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page.

(Inherited from Control)
ClearCachedClientID() ClearCachedClientID() ClearCachedClientID() ClearCachedClientID()

將快取的 ClientID 值設定為 nullSets the cached ClientID value to null.

(Inherited from Control)
ClearChildControlState() ClearChildControlState() ClearChildControlState() ClearChildControlState()

刪除伺服器控制項之子控制項的控制項狀態資訊。Deletes the control-state information for the server control's child controls.

(Inherited from Control)
ClearChildState() ClearChildState() ClearChildState() ClearChildState()

刪除所有伺服器控制項之子控制項的檢視狀態和控制項狀態資訊。Deletes the view-state and control-state information for all the server control's child controls.

(Inherited from Control)
ClearChildViewState() ClearChildViewState() ClearChildViewState() ClearChildViewState()

刪除所有伺服器控制項之子控制項的檢視狀態資訊。Deletes the view-state information for all the server control's child controls.

(Inherited from Control)
ClearEffectiveClientIDMode() ClearEffectiveClientIDMode() ClearEffectiveClientIDMode() ClearEffectiveClientIDMode()

將目前的控制項執行個體和任何子控制項的 ClientIDMode 屬性設定為 InheritSets the ClientIDMode property of the current control instance and of any child controls to Inherit.

(Inherited from Control)
CreateChildControls() CreateChildControls() CreateChildControls() CreateChildControls()

由 ASP.NET 網頁架構呼叫,通知使用組合實作的伺服器控制項來建立所包含的任何子控制項,以準備回傳或呈現。Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.

(Inherited from Control)
CreateControlCollection() CreateControlCollection() CreateControlCollection() CreateControlCollection()

建立儲存子控制項的集合。Creates a collection to store child controls.

(Inherited from DataSourceControl)
CreateQueryableView() CreateQueryableView() CreateQueryableView() CreateQueryableView()

傳回可查詢的檢視。Returns a queryable view.

CreateView() CreateView() CreateView() CreateView()

建立與這個控制項關聯之 LinqDataSourceView 類別的新執行個體。Creates a new instance of the LinqDataSourceView class that is associated with this control.

DataBind() DataBind() DataBind() DataBind()

將資料來源繫結至叫用的伺服器控制項和它的全部子控制項。Binds a data source to the invoked server control and all its child controls.

(Inherited from Control)
DataBind(Boolean) DataBind(Boolean) DataBind(Boolean) DataBind(Boolean)

使用會引發 DataBinding 事件的選項,繫結資料來源至叫用的伺服器控制項及其所有子控制項。Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event.

(Inherited from Control)
DataBindChildren() DataBindChildren() DataBindChildren() DataBindChildren()

繫結資料來源至伺服器控制項的子控制項。Binds a data source to the server control's child controls.

(Inherited from Control)
Delete(IDictionary, IDictionary) Delete(IDictionary, IDictionary) Delete(IDictionary, IDictionary) Delete(IDictionary, IDictionary)

執行刪除作業。Performs a delete operation.

Dispose() Dispose() Dispose() Dispose()

啟用伺服器控制項,在它從記憶體釋放之前執行最後清除。Enables a server control to perform final clean up before it is released from memory.

(Inherited from Control)
EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object)

結束轉譯資料的設計階段追蹤。Ends design-time tracing of rendering data.

(Inherited from Control)
EnsureChildControls() EnsureChildControls() EnsureChildControls() EnsureChildControls()

判斷伺服器控制項是否包含子控制項。Determines whether the server control contains child controls. 如果不包含,則建立子控制項。If it does not, it creates child controls.

(Inherited from Control)
EnsureID() EnsureID() EnsureID() EnsureID()

為尚未指定識別項的控制項,建立識別項。Creates an identifier for controls that do not have an identifier assigned.

(Inherited from Control)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
FindControl(String) FindControl(String) FindControl(String) FindControl(String)

在目前命名容器搜尋具有指定 id 參數的伺服器控制項。Searches the current naming container for a server control with the specified id parameter.

(Inherited from DataSourceControl)
FindControl(String, Int32) FindControl(String, Int32) FindControl(String, Int32) FindControl(String, Int32)

使用指定的 id 和有助於搜尋之 pathOffset 參數中所指定的整數,在目前的命名容器中搜尋伺服器控制項。Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search. 您不應該覆寫這個版本的 FindControl 方法。You should not override this version of the FindControl method.

(Inherited from Control)
Focus() Focus() Focus() Focus()

設定控制項的輸入焦點。Sets input focus to the control.

(Inherited from DataSourceControl)
GetDesignModeState() GetDesignModeState() GetDesignModeState() GetDesignModeState()

取得控制項的設計階段資料。Gets design-time data for a control.

(Inherited from Control)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetRouteUrl(Object) GetRouteUrl(Object) GetRouteUrl(Object) GetRouteUrl(Object)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

(Inherited from Control)
GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

(Inherited from Control)
GetRouteUrl(String, Object) GetRouteUrl(String, Object) GetRouteUrl(String, Object) GetRouteUrl(String, Object)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

(Inherited from Control)
GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

(Inherited from Control)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control)

傳回指定之控制項 UniqueID 屬性的前置部分。Returns the prefixed portion of the UniqueID property of the specified control.

(Inherited from Control)
GetView(String) GetView(String) GetView(String) GetView(String)

傳回與 LinqDataSource 物件建立關聯的資料來源檢視。Returns the data source view that is associated with the LinqDataSource object.

GetViewNames() GetViewNames() GetViewNames() GetViewNames()

傳回名稱集合,代表與 LinqDataSource 控制項建立關聯之檢視物件的清單。Returns a collection of names that represents the list of view objects that are associated with the LinqDataSource control.

HasControls() HasControls() HasControls() HasControls()

判斷伺服器控制項是否包含任何子控制項。Determines if the server control contains any child controls.

(Inherited from DataSourceControl)
HasEvents() HasEvents() HasEvents() HasEvents()

傳回值,指出控制項或任何子控制項的事件是否已註冊。Returns a value indicating whether events are registered for the control or any child controls.

(Inherited from Control)
Insert(IDictionary) Insert(IDictionary) Insert(IDictionary) Insert(IDictionary)

執行插入作業。Performs an insert operation.

IsLiteralContent() IsLiteralContent() IsLiteralContent() IsLiteralContent()

判斷伺服器控制項是否只儲存常值內容。Determines if the server control holds only literal content.

(Inherited from Control)
LoadControlState(Object) LoadControlState(Object) LoadControlState(Object) LoadControlState(Object)

SaveControlState() 方法所儲存的上一頁要求中,還原控制項狀態資訊。Restores control-state information from a previous page request that was saved by the SaveControlState() method.

(Inherited from Control)
LoadViewState(Object) LoadViewState(Object) LoadViewState(Object) LoadViewState(Object)

載入 LinqDataSource 控制項中必須保存的值狀態。Loads the state of the values in the LinqDataSource control that must be persisted.

MapPathSecure(String) MapPathSecure(String) MapPathSecure(String) MapPathSecure(String)

擷取虛擬絕對路徑或相對路徑所對應至的實體路徑。Retrieves the physical path that a virtual path, either absolute or relative, maps to.

(Inherited from Control)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs)

決定伺服器控制項的事件是否要在頁面的 UI 伺服器控制項階層架構中向上傳遞。Determines whether the event for the server control is passed up the page's UI server control hierarchy.

(Inherited from Control)
OnDataBinding(EventArgs) OnDataBinding(EventArgs) OnDataBinding(EventArgs) OnDataBinding(EventArgs)

引發 DataBinding 事件。Raises the DataBinding event.

(Inherited from Control)
OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs)

初始化 LinqDataSource 物件。Initializes the LinqDataSource object.

OnLoad(EventArgs) OnLoad(EventArgs) OnLoad(EventArgs) OnLoad(EventArgs)

引發 Load 事件。Raises the Load event.

(Inherited from Control)
OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs)

引發 PreRender 事件。Raises the PreRender event.

(Inherited from Control)
OnUnload(EventArgs) OnUnload(EventArgs) OnUnload(EventArgs) OnUnload(EventArgs)

引發 Unload 事件。Raises the Unload event.

OpenFile(String) OpenFile(String) OpenFile(String) OpenFile(String)

取得用來讀取檔案的 StreamGets a Stream used to read a file.

(Inherited from Control)
RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs)

指派事件的任何來源和它的資訊至控制項的父控制項。Assigns any sources of the event and its information to the control's parent.

(Inherited from Control)
RaiseDataSourceChangedEvent(EventArgs) RaiseDataSourceChangedEvent(EventArgs) RaiseDataSourceChangedEvent(EventArgs) RaiseDataSourceChangedEvent(EventArgs)

引發 DataSourceChanged 事件。Raises the DataSourceChanged event.

(Inherited from DataSourceControl)
RemovedControl(Control) RemovedControl(Control) RemovedControl(Control) RemovedControl(Control)

Control 物件的 Controls 集合中移除子控制項之後呼叫。Called after a child control is removed from the Controls collection of the Control object.

(Inherited from Control)
Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter)

將伺服器控制項內容傳送到提供的 HtmlTextWriter 物件,以寫入要在用戶端上呈現的內容。Sends server control content to a provided HtmlTextWriter object, which writes the content to be rendered on the client.

(Inherited from Control)
RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter)

輸出伺服器控制項之子控制項的內容至提供的 HtmlTextWriter 物件,這個物件會寫入用戶端上所要呈現的內容。Outputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client.

(Inherited from Control)
RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter)

將伺服器控制項內容輸出至提供的 HtmlTextWriter 物件,並在啟用追蹤時儲存控制項的追蹤資訊。Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled.

(Inherited from DataSourceControl)
RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter)

使用提供的 HtmlTextWriter 物件,輸出伺服器控制項內容至提供的 ControlAdapter 物件。Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object.

(Inherited from Control)
ResolveAdapter() ResolveAdapter() ResolveAdapter() ResolveAdapter()

取得負責呈現指定之控制項的控制項配置器。Gets the control adapter responsible for rendering the specified control.

(Inherited from Control)
ResolveClientUrl(String) ResolveClientUrl(String) ResolveClientUrl(String) ResolveClientUrl(String)

取得瀏覽器可使用的 URL。Gets a URL that can be used by the browser.

(Inherited from Control)
ResolveUrl(String) ResolveUrl(String) ResolveUrl(String) ResolveUrl(String)

將 URL 轉換為要求用戶端可使用的 URL。Converts a URL into one that is usable on the requesting client.

(Inherited from Control)
SaveControlState() SaveControlState() SaveControlState() SaveControlState()

儲存頁面回傳至伺服器以來,所發生的任何伺服器控制項狀態變更。Saves any server control state changes that have occurred since the time the page was posted back to the server.

(Inherited from Control)
SaveViewState() SaveViewState() SaveViewState() SaveViewState()

儲存 LinqDataSource 控制項的目前檢視狀態。Saves the current view state of the LinqDataSource control.

SetDesignModeState(IDictionary) SetDesignModeState(IDictionary) SetDesignModeState(IDictionary) SetDesignModeState(IDictionary)

設定控制項的設計階段資料。Sets design-time data for a control.

(Inherited from Control)
SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod)

指定事件處理常式委派,以呈現伺服器控制項及其內容至其父控制項。Assigns an event handler delegate to render the server control and its content into its parent control.

(Inherited from Control)
SetTraceData(Object, Object) SetTraceData(Object, Object) SetTraceData(Object, Object) SetTraceData(Object, Object)

使用追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the trace data key and the trace data value.

(Inherited from Control)
SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object)

使用追蹤的物體、追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the traced object, the trace data key, and the trace data value.

(Inherited from Control)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
TrackViewState() TrackViewState() TrackViewState() TrackViewState()

追蹤 LinqDataSource 控制項的檢視狀態變更,以便變更可以儲存在控制項的 StateBag 物件中。Tracks view state changes to the LinqDataSource control so that the changes can be stored in the StateBag object for the control.

Update(IDictionary, IDictionary, IDictionary) Update(IDictionary, IDictionary, IDictionary) Update(IDictionary, IDictionary, IDictionary) Update(IDictionary, IDictionary, IDictionary)

執行更新作業。Performs an update operation.

事件

ContextCreated ContextCreated ContextCreated ContextCreated

在建立內容型別物件的執行個體之後發生。Occurs after an instance of the context type object is created.

ContextCreating ContextCreating ContextCreating ContextCreating

在建立內容型別物件的執行個體之前發生。Occurs before an instance of the context type object is created.

ContextDisposing ContextDisposing ContextDisposing ContextDisposing

在處置內容型別物件之前發生。Occurs before disposing the context type object.

DataBinding DataBinding DataBinding DataBinding

發生於伺服器控制項繫結至資料來源時。Occurs when the server control binds to a data source.

(Inherited from Control)
Deleted Deleted Deleted Deleted

在刪除作業完成時發生。Occurs when a delete operation has finished.

Deleting Deleting Deleting Deleting

在刪除作業之前發生。Occurs before a delete operation.

Disposed Disposed Disposed Disposed

發生於伺服器控制項從記憶體釋放時,這是在要求 ASP.NET 網頁時,伺服器控制項生命週期的最後階段。Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested.

(Inherited from Control)
IDataSource.DataSourceChanged IDataSource.DataSourceChanged IDataSource.DataSourceChanged IDataSource.DataSourceChanged

當資料來源控制項變更的方式會影響資料繫結控制項時發生。Occurs when a data source control has changed in a way that affects data-bound controls.

(Inherited from DataSourceControl)
Init Init Init Init

發生於初始化伺服器控制項時,是其生命週期中的第一個步驟。Occurs when the server control is initialized, which is the first step in its lifecycle.

(Inherited from Control)
Inserted Inserted Inserted Inserted

在插入作業完成時發生。Occurs when an insert operation has finished.

Inserting Inserting Inserting Inserting

在插入作業之前發生。Occurs before an insert operation.

Load Load Load Load

發生於載入伺服器控制項至 Page 物件時。Occurs when the server control is loaded into the Page object.

(Inherited from Control)
PreRender PreRender PreRender PreRender

Control 物件載入之後但在呈現之前發生。Occurs after the Control object is loaded but prior to rendering.

(Inherited from Control)
Selected Selected Selected Selected

在資料擷取作業完成時發生。Occurs when a data retrieval operation has finished.

Selecting Selecting Selecting Selecting

在資料擷取作業之前發生。Occurs before a data-retrieval operation.

Unload Unload Unload Unload

發生於伺服器控制項從記憶體卸載時。Occurs when the server control is unloaded from memory.

(Inherited from Control)
Updated Updated Updated Updated

在更新作業完成時發生。Occurs when an update operation has finished.

Updating Updating Updating Updating

在更新作業之前發生。Occurs before an update operation.

明確介面實作

IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState()

如需這個成員的說明,請參閱 GetDesignModeState()For a description of this member, see GetDesignModeState().

(Inherited from Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary)

如需這個成員的說明,請參閱 SetDesignModeState(IDictionary)For a description of this member, see SetDesignModeState(IDictionary).

(Inherited from Control)
IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control)

如需這個成員的說明,請參閱 SetOwnerControl(Control)For a description of this member, see SetOwnerControl(Control).

(Inherited from Control)
IDataSource.GetView(String) IDataSource.GetView(String) IDataSource.GetView(String) IDataSource.GetView(String)

取得與 DataSourceView 控制項關聯的具名 DataSourceControl 物件。Gets the named DataSourceView object associated with the DataSourceControl control. 有些資料來源控制項只支援一個檢視,有些則可支援多個檢視。Some data source controls support only one view, while others support more than one.

(Inherited from DataSourceControl)
IDataSource.GetViewNames() IDataSource.GetViewNames() IDataSource.GetViewNames() IDataSource.GetViewNames()

取得名稱集合,表示與 DataSourceView 控制項關聯的 DataSourceControl 物件清單。Gets a collection of names, representing the list of DataSourceView objects associated with the DataSourceControl control.

(Inherited from DataSourceControl)
IDynamicDataSource.ContextType IDynamicDataSource.ContextType IDynamicDataSource.ContextType IDynamicDataSource.ContextType

如需這個成員的說明,請參閱 IDynamicDataSourceFor a description of this member, see IDynamicDataSource.

IDynamicDataSource.EntitySetName IDynamicDataSource.EntitySetName IDynamicDataSource.EntitySetName IDynamicDataSource.EntitySetName

如需這個成員的說明,請參閱 IDynamicDataSourceFor a description of this member, see IDynamicDataSource.

IDynamicDataSource.Exception IDynamicDataSource.Exception IDynamicDataSource.Exception IDynamicDataSource.Exception

如需這個成員的說明,請參閱 IDynamicDataSourceFor a description of this member, see IDynamicDataSource.

IListSource.GetList() IListSource.GetList() IListSource.GetList() IListSource.GetList()

取得可以當做資料清單來源使用的資料來源控制項清單。Gets a list of data source controls that can be used as sources of lists of data.

(Inherited from DataSourceControl)
IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object)

如需這個成員的說明,請參閱 AddParsedSubObject(Object)For a description of this member, see AddParsedSubObject(Object).

(Inherited from Control)

擴充方法

ExpandDynamicWhereParameters(IDynamicDataSource) ExpandDynamicWhereParameters(IDynamicDataSource) ExpandDynamicWhereParameters(IDynamicDataSource) ExpandDynamicWhereParameters(IDynamicDataSource)

將動態篩選條件擴大成資料來源可用的 Where 參數。Expands dynamic filters into Where parameters that are usable by the data source.

FindDataSourceControl(Control) FindDataSourceControl(Control) FindDataSourceControl(Control) FindDataSourceControl(Control)

傳回與指定之控制項的資料控制項相關聯的資料來源。Returns the data source that is associated with the data control for the specified control.

FindFieldTemplate(Control, String) FindFieldTemplate(Control, String) FindFieldTemplate(Control, String) FindFieldTemplate(Control, String)

傳回在指定之控制項的命名容器中所指定資料行的欄位樣板。Returns the field template for the specified column in the specified control's naming container.

FindMetaTable(Control) FindMetaTable(Control) FindMetaTable(Control) FindMetaTable(Control)

傳回包含資料控制項的中繼資料表物件。Returns the metatable object for the containing data control.

GetDefaultValues(IDataSource) GetDefaultValues(IDataSource) GetDefaultValues(IDataSource) GetDefaultValues(IDataSource)

取得所指定資料來源的預設值集合。Gets the collection of the default values for the specified data source.

GetMetaTable(IDataSource) GetMetaTable(IDataSource) GetMetaTable(IDataSource) GetMetaTable(IDataSource)

取得所指定資料來源物件中的資料表中繼資料。Gets the metadata for a table in the specified data source object.

GetTable(IDynamicDataSource) GetTable(IDynamicDataSource) GetTable(IDynamicDataSource) GetTable(IDynamicDataSource)

傳回與指定之資料來源控制項相關聯的 MetaTable 物件。Returns the MetaTable object that is associated with the specified data source control.

LoadWith<TEntity>(LinqDataSource) LoadWith<TEntity>(LinqDataSource) LoadWith<TEntity>(LinqDataSource) LoadWith<TEntity>(LinqDataSource)

設定 LINQ-to-SQL 的 DataLoadOptions 值,以強制載入所有外部索引鍵實體 (Entity)。Sets the DataLoadOptions value of a LINQ-to-SQL data source to force all the foreign-key entities to be loaded.

LoadWithForeignKeys(LinqDataSource, Type) LoadWithForeignKeys(LinqDataSource, Type) LoadWithForeignKeys(LinqDataSource, Type) LoadWithForeignKeys(LinqDataSource, Type)

設定 LINQ-to-SQL 的 DataLoadOptions 值,以強制載入所有外部索引鍵實體 (Entity)。Sets the DataLoadOptions value of a LINQ-to-SQL data source to force all the foreign-key entities to be loaded.

TryGetMetaTable(IDataSource, MetaTable) TryGetMetaTable(IDataSource, MetaTable) TryGetMetaTable(IDataSource, MetaTable) TryGetMetaTable(IDataSource, MetaTable)

判斷資料表中繼資料是否可供使用。Determines whether table metadata is available.

適用於

另請參閱